diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 633d1a8299d..2f45f5bdfbf 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -7021,14 +7021,7 @@ module ts { function checkNumericLiteral(node: LiteralExpression): Type { // Grammar checking - if (node.flags & NodeFlags.OctalLiteral) { - if (node.parserContextFlags & ParserContextFlags.StrictMode) { - grammarErrorOnNode(node, Diagnostics.Octal_literals_are_not_allowed_in_strict_mode); - } - else if (compilerOptions.target >= ScriptTarget.ES5) { - grammarErrorOnNode(node, Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher); - } - } + checkGrammarNumbericLiteral(node); return numberType; } @@ -10362,8 +10355,7 @@ module ts { // Grammar checking for computedPropertName and shorthandPropertyAssignment checkGrammarForInvalidQuestionMark(prop,(prop).questionToken, Diagnostics.An_object_member_cannot_be_declared_optional); if (name.kind === SyntaxKind.NumericLiteral) { - } - else if (name.kind === SyntaxKind.StringLiteral) { + checkGrammarNumbericLiteral(name); } currentKind = Property; } @@ -10455,7 +10447,6 @@ module ts { function checkGrammarMethod(node: MethodDeclaration) { if (checkGrammarFunctionLikeDeclaration(node) || - checkGrammarForBodyInAmbientContext(node.body, /*isConstructor:*/ false) || checkGrammarForGenerator(node)) { return true; } @@ -10734,16 +10725,6 @@ module ts { } } - function checkGrammarForBodyInAmbientContext(body: Block | Expression, isConstructor: boolean): boolean { - if (isInAmbientContext(body) && body && body.kind === SyntaxKind.Block) { - - var diagnostic = isConstructor - ? Diagnostics.A_constructor_implementation_cannot_be_declared_in_an_ambient_context - : Diagnostics.A_function_implementation_cannot_be_declared_in_an_ambient_context; - return getNodeLinks(body).hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(body, diagnostic); - } - } - function checkGrammarProperty(node: PropertyDeclaration) { if (node.parent.kind === SyntaxKind.ClassDeclaration) { if (checkGrammarForInvalidQuestionMark(node, node.questionToken, Diagnostics.A_class_member_cannot_be_declared_optional) || @@ -10839,6 +10820,18 @@ module ts { } } + function checkGrammarNumbericLiteral(node: Identifier): boolean { + // Grammar checking + if (node.flags & NodeFlags.OctalLiteral) { + if (node.parserContextFlags & ParserContextFlags.StrictMode) { + return grammarErrorOnNode(node, Diagnostics.Octal_literals_are_not_allowed_in_strict_mode); + } + else if (compilerOptions.target >= ScriptTarget.ES5) { + return grammarErrorOnNode(node, Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher); + } + } + } + function grammarErrorAfterFirstToken(node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): boolean { var sourceFile = getSourceFileOfNode(node); if (!hasParseDiagnostics(sourceFile)) { diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index a0952cb9f8e..55399deaabe 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -50,7 +50,7 @@ module ts { An_export_assignment_cannot_be_used_in_an_internal_module: { code: 1063, category: DiagnosticCategory.Error, key: "An export assignment cannot be used in an internal module.", isEarly: true }, Ambient_enum_elements_can_only_have_integer_literal_initializers: { code: 1066, category: DiagnosticCategory.Error, key: "Ambient enum elements can only have integer literal initializers.", isEarly: true }, Unexpected_token_A_constructor_method_accessor_or_property_was_expected: { code: 1068, category: DiagnosticCategory.Error, key: "Unexpected token. A constructor, method, accessor, or property was expected." }, - A_declare_modifier_cannot_be_used_with_an_import_declaration: { code: 1079, category: DiagnosticCategory.Error, key: "A 'declare' modifier cannot be used with an import declaration." }, + A_declare_modifier_cannot_be_used_with_an_import_declaration: { code: 1079, category: DiagnosticCategory.Error, key: "A 'declare' modifier cannot be used with an import declaration.", isEarly: true }, Invalid_reference_directive_syntax: { code: 1084, category: DiagnosticCategory.Error, key: "Invalid 'reference' directive syntax." }, Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { code: 1085, category: DiagnosticCategory.Error, key: "Octal literals are not available when targeting ECMAScript 5 and higher.", isEarly: true }, An_accessor_cannot_be_declared_in_an_ambient_context: { code: 1086, category: DiagnosticCategory.Error, key: "An accessor cannot be declared in an ambient context.", isEarly: true }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 6e724839803..fb3e50e3065 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -228,7 +228,8 @@ }, "A 'declare' modifier cannot be used with an import declaration.": { "category": "Error", - "code": 1079 + "code": 1079, + "isEarly": true }, "Invalid 'reference' directive syntax.": { "category": "Error", diff --git a/tests/baselines/reference/ambientErrors.errors.txt b/tests/baselines/reference/ambientErrors.errors.txt index eb06b785914..c8159708dd8 100644 --- a/tests/baselines/reference/ambientErrors.errors.txt +++ b/tests/baselines/reference/ambientErrors.errors.txt @@ -9,8 +9,8 @@ tests/cases/conformance/ambient/ambientErrors.ts(35,19): error TS1184: An implem tests/cases/conformance/ambient/ambientErrors.ts(37,20): error TS1039: Initializers are not allowed in ambient contexts. tests/cases/conformance/ambient/ambientErrors.ts(38,13): error TS1039: Initializers are not allowed in ambient contexts. tests/cases/conformance/ambient/ambientErrors.ts(39,23): error TS1184: An implementation cannot be declared in ambient contexts. -tests/cases/conformance/ambient/ambientErrors.ts(40,14): error TS1037: A function implementation cannot be declared in an ambient context. -tests/cases/conformance/ambient/ambientErrors.ts(41,22): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/conformance/ambient/ambientErrors.ts(40,14): error TS1184: An implementation cannot be declared in ambient contexts. +tests/cases/conformance/ambient/ambientErrors.ts(41,22): error TS1184: An implementation cannot be declared in ambient contexts. tests/cases/conformance/ambient/ambientErrors.ts(47,20): error TS2435: Ambient external modules cannot be nested in other modules. tests/cases/conformance/ambient/ambientErrors.ts(51,16): error TS2436: Ambient external module declaration cannot specify relative module name. tests/cases/conformance/ambient/ambientErrors.ts(57,5): error TS2309: An export assignment cannot be used in a module with other exported elements. @@ -80,10 +80,10 @@ tests/cases/conformance/ambient/ambientErrors.ts(57,5): error TS2309: An export !!! error TS1184: An implementation cannot be declared in ambient contexts. fn() { } ~ -!!! error TS1037: A function implementation cannot be declared in an ambient context. +!!! error TS1184: An implementation cannot be declared in ambient contexts. static sfn() { } ~ -!!! error TS1037: A function implementation cannot be declared in an ambient context. +!!! error TS1184: An implementation cannot be declared in ambient contexts. } } diff --git a/tests/baselines/reference/externSyntax.errors.txt b/tests/baselines/reference/externSyntax.errors.txt index 099c9fa3a99..1d3380b99d5 100644 --- a/tests/baselines/reference/externSyntax.errors.txt +++ b/tests/baselines/reference/externSyntax.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/externSyntax.ts(8,20): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/externSyntax.ts(8,20): error TS1184: An implementation cannot be declared in ambient contexts. ==== tests/cases/compiler/externSyntax.ts (1 errors) ==== @@ -11,7 +11,7 @@ tests/cases/compiler/externSyntax.ts(8,20): error TS1037: A function implementat public f(); public g() { } // error body ~ -!!! error TS1037: A function implementation cannot be declared in an ambient context. +!!! error TS1184: An implementation cannot be declared in ambient contexts. } } diff --git a/tests/baselines/reference/giant.errors.txt b/tests/baselines/reference/giant.errors.txt index 5a356ab6f2a..fbe05bbfc79 100644 --- a/tests/baselines/reference/giant.errors.txt +++ b/tests/baselines/reference/giant.errors.txt @@ -68,31 +68,31 @@ tests/cases/compiler/giant.ts(219,9): error TS2386: Overload signatures must all tests/cases/compiler/giant.ts(233,39): error TS1184: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(238,35): error TS1184: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(240,24): error TS1184: An implementation cannot be declared in ambient contexts. -tests/cases/compiler/giant.ts(243,21): error TS1037: A function implementation cannot be declared in an ambient context. -tests/cases/compiler/giant.ts(244,22): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(243,21): error TS1184: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/giant.ts(244,22): error TS1184: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(245,16): error TS2300: Duplicate identifier 'pgF'. -tests/cases/compiler/giant.ts(245,22): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(245,22): error TS1184: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(246,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(246,20): error TS2300: Duplicate identifier 'pgF'. tests/cases/compiler/giant.ts(247,16): error TS2300: Duplicate identifier 'psF'. -tests/cases/compiler/giant.ts(247,31): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(247,31): error TS1184: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(248,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(248,20): error TS2300: Duplicate identifier 'psF'. tests/cases/compiler/giant.ts(249,17): error TS2300: Duplicate identifier 'rgF'. -tests/cases/compiler/giant.ts(249,23): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(249,23): error TS1184: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(250,21): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(250,21): error TS2300: Duplicate identifier 'rgF'. tests/cases/compiler/giant.ts(251,17): error TS2300: Duplicate identifier 'rsF'. -tests/cases/compiler/giant.ts(251,32): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(251,32): error TS1184: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(252,21): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(252,21): error TS2300: Duplicate identifier 'rsF'. -tests/cases/compiler/giant.ts(254,21): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(254,21): error TS1184: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(255,16): error TS2300: Duplicate identifier 'tsF'. -tests/cases/compiler/giant.ts(255,31): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(255,31): error TS1184: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(256,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(256,20): error TS2300: Duplicate identifier 'tsF'. tests/cases/compiler/giant.ts(257,16): error TS2300: Duplicate identifier 'tgF'. -tests/cases/compiler/giant.ts(257,22): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(257,22): error TS1184: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(258,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(258,20): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(262,22): error TS1184: An implementation cannot be declared in ambient contexts. @@ -168,31 +168,31 @@ tests/cases/compiler/giant.ts(477,9): error TS2386: Overload signatures must all tests/cases/compiler/giant.ts(491,39): error TS1184: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(496,35): error TS1184: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(498,24): error TS1184: An implementation cannot be declared in ambient contexts. -tests/cases/compiler/giant.ts(501,21): error TS1037: A function implementation cannot be declared in an ambient context. -tests/cases/compiler/giant.ts(502,22): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(501,21): error TS1184: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/giant.ts(502,22): error TS1184: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(503,16): error TS2300: Duplicate identifier 'pgF'. -tests/cases/compiler/giant.ts(503,22): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(503,22): error TS1184: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(504,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(504,20): error TS2300: Duplicate identifier 'pgF'. tests/cases/compiler/giant.ts(505,16): error TS2300: Duplicate identifier 'psF'. -tests/cases/compiler/giant.ts(505,31): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(505,31): error TS1184: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(506,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(506,20): error TS2300: Duplicate identifier 'psF'. tests/cases/compiler/giant.ts(507,17): error TS2300: Duplicate identifier 'rgF'. -tests/cases/compiler/giant.ts(507,23): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(507,23): error TS1184: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(508,21): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(508,21): error TS2300: Duplicate identifier 'rgF'. tests/cases/compiler/giant.ts(509,17): error TS2300: Duplicate identifier 'rsF'. -tests/cases/compiler/giant.ts(509,32): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(509,32): error TS1184: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(510,21): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(510,21): error TS2300: Duplicate identifier 'rsF'. -tests/cases/compiler/giant.ts(512,21): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(512,21): error TS1184: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(513,16): error TS2300: Duplicate identifier 'tsF'. -tests/cases/compiler/giant.ts(513,31): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(513,31): error TS1184: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(514,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(514,20): error TS2300: Duplicate identifier 'tsF'. tests/cases/compiler/giant.ts(515,16): error TS2300: Duplicate identifier 'tgF'. -tests/cases/compiler/giant.ts(515,22): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(515,22): error TS1184: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(516,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(516,20): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(520,22): error TS1184: An implementation cannot be declared in ambient contexts. @@ -200,38 +200,38 @@ tests/cases/compiler/giant.ts(520,25): error TS1036: Statements are not allowed tests/cases/compiler/giant.ts(525,30): error TS1184: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(532,31): error TS1184: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(534,20): error TS1184: An implementation cannot be declared in ambient contexts. -tests/cases/compiler/giant.ts(537,17): error TS1037: A function implementation cannot be declared in an ambient context. -tests/cases/compiler/giant.ts(538,18): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(537,17): error TS1184: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/giant.ts(538,18): error TS1184: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(539,12): error TS2300: Duplicate identifier 'pgF'. -tests/cases/compiler/giant.ts(539,18): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(539,18): error TS1184: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(540,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(540,16): error TS2300: Duplicate identifier 'pgF'. tests/cases/compiler/giant.ts(541,12): error TS2300: Duplicate identifier 'psF'. -tests/cases/compiler/giant.ts(541,27): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(541,27): error TS1184: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(542,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(542,16): error TS2300: Duplicate identifier 'psF'. tests/cases/compiler/giant.ts(543,13): error TS2300: Duplicate identifier 'rgF'. -tests/cases/compiler/giant.ts(543,19): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(543,19): error TS1184: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(544,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(544,17): error TS2300: Duplicate identifier 'rgF'. tests/cases/compiler/giant.ts(545,13): error TS2300: Duplicate identifier 'rsF'. -tests/cases/compiler/giant.ts(545,28): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(545,28): error TS1184: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(546,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(546,17): error TS2300: Duplicate identifier 'rsF'. -tests/cases/compiler/giant.ts(548,17): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(548,17): error TS1184: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(549,12): error TS2300: Duplicate identifier 'tsF'. -tests/cases/compiler/giant.ts(549,27): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(549,27): error TS1184: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(550,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(550,16): error TS2300: Duplicate identifier 'tsF'. tests/cases/compiler/giant.ts(551,12): error TS2300: Duplicate identifier 'tgF'. -tests/cases/compiler/giant.ts(551,18): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(551,18): error TS1184: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(552,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(552,16): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(556,18): error TS1184: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(556,21): error TS1036: Statements are not allowed in ambient contexts. tests/cases/compiler/giant.ts(558,24): error TS1184: An implementation cannot be declared in ambient contexts. -tests/cases/compiler/giant.ts(561,21): error TS1037: A function implementation cannot be declared in an ambient context. -tests/cases/compiler/giant.ts(563,21): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(561,21): error TS1184: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/giant.ts(563,21): error TS1184: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(587,9): error TS1169: Computed property names are not allowed in interfaces. tests/cases/compiler/giant.ts(588,9): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(589,10): error TS1096: An index signature must have exactly one parameter. @@ -246,8 +246,8 @@ tests/cases/compiler/giant.ts(617,16): error TS1038: A 'declare' modifier cannot tests/cases/compiler/giant.ts(618,16): error TS1038: A 'declare' modifier cannot be used in an already ambient context. tests/cases/compiler/giant.ts(621,26): error TS1184: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(623,24): error TS1184: An implementation cannot be declared in ambient contexts. -tests/cases/compiler/giant.ts(626,21): error TS1037: A function implementation cannot be declared in an ambient context. -tests/cases/compiler/giant.ts(628,21): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/giant.ts(626,21): error TS1184: An implementation cannot be declared in ambient contexts. +tests/cases/compiler/giant.ts(628,21): error TS1184: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(653,9): error TS1169: Computed property names are not allowed in interfaces. tests/cases/compiler/giant.ts(654,9): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(655,10): error TS1096: An index signature must have exactly one parameter. @@ -642,15 +642,15 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be private rV; public pF() { } ~ -!!! error TS1037: A function implementation cannot be declared in an ambient context. +!!! error TS1184: An implementation cannot be declared in ambient contexts. private rF() { } ~ -!!! error TS1037: A function implementation cannot be declared in an ambient context. +!!! error TS1184: An implementation cannot be declared in ambient contexts. public pgF() { } ~~~ !!! error TS2300: Duplicate identifier 'pgF'. ~ -!!! error TS1037: A function implementation cannot be declared in an ambient context. +!!! error TS1184: An implementation cannot be declared in ambient contexts. public get pgF() ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -660,7 +660,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be ~~~ !!! error TS2300: Duplicate identifier 'psF'. ~ -!!! error TS1037: A function implementation cannot be declared in an ambient context. +!!! error TS1184: An implementation cannot be declared in ambient contexts. public set psF(param:any) ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -670,7 +670,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be ~~~ !!! error TS2300: Duplicate identifier 'rgF'. ~ -!!! error TS1037: A function implementation cannot be declared in an ambient context. +!!! error TS1184: An implementation cannot be declared in ambient contexts. private get rgF() ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -680,7 +680,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be ~~~ !!! error TS2300: Duplicate identifier 'rsF'. ~ -!!! error TS1037: A function implementation cannot be declared in an ambient context. +!!! error TS1184: An implementation cannot be declared in ambient contexts. private set rsF(param:any) ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -689,12 +689,12 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be static tV; static tF() { } ~ -!!! error TS1037: A function implementation cannot be declared in an ambient context. +!!! error TS1184: An implementation cannot be declared in ambient contexts. static tsF(param:any) { } ~~~ !!! error TS2300: Duplicate identifier 'tsF'. ~ -!!! error TS1037: A function implementation cannot be declared in an ambient context. +!!! error TS1184: An implementation cannot be declared in ambient contexts. static set tsF(param:any) ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -704,7 +704,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be ~~~ !!! error TS2300: Duplicate identifier 'tgF'. ~ -!!! error TS1037: A function implementation cannot be declared in an ambient context. +!!! error TS1184: An implementation cannot be declared in ambient contexts. static get tgF() ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -1100,15 +1100,15 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be private rV; public pF() { } ~ -!!! error TS1037: A function implementation cannot be declared in an ambient context. +!!! error TS1184: An implementation cannot be declared in ambient contexts. private rF() { } ~ -!!! error TS1037: A function implementation cannot be declared in an ambient context. +!!! error TS1184: An implementation cannot be declared in ambient contexts. public pgF() { } ~~~ !!! error TS2300: Duplicate identifier 'pgF'. ~ -!!! error TS1037: A function implementation cannot be declared in an ambient context. +!!! error TS1184: An implementation cannot be declared in ambient contexts. public get pgF() ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -1118,7 +1118,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be ~~~ !!! error TS2300: Duplicate identifier 'psF'. ~ -!!! error TS1037: A function implementation cannot be declared in an ambient context. +!!! error TS1184: An implementation cannot be declared in ambient contexts. public set psF(param:any) ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -1128,7 +1128,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be ~~~ !!! error TS2300: Duplicate identifier 'rgF'. ~ -!!! error TS1037: A function implementation cannot be declared in an ambient context. +!!! error TS1184: An implementation cannot be declared in ambient contexts. private get rgF() ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -1138,7 +1138,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be ~~~ !!! error TS2300: Duplicate identifier 'rsF'. ~ -!!! error TS1037: A function implementation cannot be declared in an ambient context. +!!! error TS1184: An implementation cannot be declared in ambient contexts. private set rsF(param:any) ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -1147,12 +1147,12 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be static tV; static tF() { } ~ -!!! error TS1037: A function implementation cannot be declared in an ambient context. +!!! error TS1184: An implementation cannot be declared in ambient contexts. static tsF(param:any) { } ~~~ !!! error TS2300: Duplicate identifier 'tsF'. ~ -!!! error TS1037: A function implementation cannot be declared in an ambient context. +!!! error TS1184: An implementation cannot be declared in ambient contexts. static set tsF(param:any) ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -1162,7 +1162,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be ~~~ !!! error TS2300: Duplicate identifier 'tgF'. ~ -!!! error TS1037: A function implementation cannot be declared in an ambient context. +!!! error TS1184: An implementation cannot be declared in ambient contexts. static get tgF() ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -1200,15 +1200,15 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be private rV; public pF() { } ~ -!!! error TS1037: A function implementation cannot be declared in an ambient context. +!!! error TS1184: An implementation cannot be declared in ambient contexts. private rF() { } ~ -!!! error TS1037: A function implementation cannot be declared in an ambient context. +!!! error TS1184: An implementation cannot be declared in ambient contexts. public pgF() { } ~~~ !!! error TS2300: Duplicate identifier 'pgF'. ~ -!!! error TS1037: A function implementation cannot be declared in an ambient context. +!!! error TS1184: An implementation cannot be declared in ambient contexts. public get pgF() ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -1218,7 +1218,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be ~~~ !!! error TS2300: Duplicate identifier 'psF'. ~ -!!! error TS1037: A function implementation cannot be declared in an ambient context. +!!! error TS1184: An implementation cannot be declared in ambient contexts. public set psF(param:any) ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -1228,7 +1228,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be ~~~ !!! error TS2300: Duplicate identifier 'rgF'. ~ -!!! error TS1037: A function implementation cannot be declared in an ambient context. +!!! error TS1184: An implementation cannot be declared in ambient contexts. private get rgF() ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -1238,7 +1238,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be ~~~ !!! error TS2300: Duplicate identifier 'rsF'. ~ -!!! error TS1037: A function implementation cannot be declared in an ambient context. +!!! error TS1184: An implementation cannot be declared in ambient contexts. private set rsF(param:any) ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -1247,12 +1247,12 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be static tV; static tF() { } ~ -!!! error TS1037: A function implementation cannot be declared in an ambient context. +!!! error TS1184: An implementation cannot be declared in ambient contexts. static tsF(param:any) { } ~~~ !!! error TS2300: Duplicate identifier 'tsF'. ~ -!!! error TS1037: A function implementation cannot be declared in an ambient context. +!!! error TS1184: An implementation cannot be declared in ambient contexts. static set tsF(param:any) ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -1262,7 +1262,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be ~~~ !!! error TS2300: Duplicate identifier 'tgF'. ~ -!!! error TS1037: A function implementation cannot be declared in an ambient context. +!!! error TS1184: An implementation cannot be declared in ambient contexts. static get tgF() ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -1284,11 +1284,11 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be private rV; public pF() { } ~ -!!! error TS1037: A function implementation cannot be declared in an ambient context. +!!! error TS1184: An implementation cannot be declared in ambient contexts. static tV; static tF() { } ~ -!!! error TS1037: A function implementation cannot be declared in an ambient context. +!!! error TS1184: An implementation cannot be declared in ambient contexts. } interface I { //Call Signature @@ -1381,11 +1381,11 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be private rV; public pF() { } ~ -!!! error TS1037: A function implementation cannot be declared in an ambient context. +!!! error TS1184: An implementation cannot be declared in ambient contexts. static tV static tF() { } ~ -!!! error TS1037: A function implementation cannot be declared in an ambient context. +!!! error TS1184: An implementation cannot be declared in ambient contexts. } export interface eI { //Call Signature diff --git a/tests/baselines/reference/initializersInDeclarations.errors.txt b/tests/baselines/reference/initializersInDeclarations.errors.txt index 5ab9ae5d2bc..9840181e092 100644 --- a/tests/baselines/reference/initializersInDeclarations.errors.txt +++ b/tests/baselines/reference/initializersInDeclarations.errors.txt @@ -1,6 +1,6 @@ tests/cases/conformance/externalModules/initializersInDeclarations.ts(5,9): error TS1039: Initializers are not allowed in ambient contexts. tests/cases/conformance/externalModules/initializersInDeclarations.ts(6,16): error TS1039: Initializers are not allowed in ambient contexts. -tests/cases/conformance/externalModules/initializersInDeclarations.ts(7,16): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/conformance/externalModules/initializersInDeclarations.ts(7,16): error TS1184: An implementation cannot be declared in ambient contexts. tests/cases/conformance/externalModules/initializersInDeclarations.ts(12,15): error TS1039: Initializers are not allowed in ambient contexts. tests/cases/conformance/externalModules/initializersInDeclarations.ts(13,15): error TS1039: Initializers are not allowed in ambient contexts. tests/cases/conformance/externalModules/initializersInDeclarations.ts(16,2): error TS1036: Statements are not allowed in ambient contexts. @@ -20,7 +20,7 @@ tests/cases/conformance/externalModules/initializersInDeclarations.ts(18,16): er !!! error TS1039: Initializers are not allowed in ambient contexts. fn(): boolean { ~ -!!! error TS1037: A function implementation cannot be declared in an ambient context. +!!! error TS1184: An implementation cannot be declared in ambient contexts. return false; } } diff --git a/tests/baselines/reference/methodInAmbientClass1.errors.txt b/tests/baselines/reference/methodInAmbientClass1.errors.txt index 2c99dfdde0a..05183378a85 100644 --- a/tests/baselines/reference/methodInAmbientClass1.errors.txt +++ b/tests/baselines/reference/methodInAmbientClass1.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/methodInAmbientClass1.ts(2,12): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement. -tests/cases/compiler/methodInAmbientClass1.ts(2,20): error TS1037: A function implementation cannot be declared in an ambient context. +tests/cases/compiler/methodInAmbientClass1.ts(2,20): error TS1184: An implementation cannot be declared in ambient contexts. ==== tests/cases/compiler/methodInAmbientClass1.ts (2 errors) ==== @@ -8,6 +8,6 @@ tests/cases/compiler/methodInAmbientClass1.ts(2,20): error TS1037: A function im ~~~~~~~ !!! error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement. ~ -!!! error TS1037: A function implementation cannot be declared in an ambient context. +!!! error TS1184: An implementation cannot be declared in ambient contexts. } } \ No newline at end of file diff --git a/tests/baselines/reference/privacyGloImportParseErrors.errors.txt b/tests/baselines/reference/privacyGloImportParseErrors.errors.txt index 5c632c09cd4..fa3b1bb522d 100644 --- a/tests/baselines/reference/privacyGloImportParseErrors.errors.txt +++ b/tests/baselines/reference/privacyGloImportParseErrors.errors.txt @@ -2,16 +2,21 @@ tests/cases/compiler/privacyGloImportParseErrors.ts(22,27): error TS2435: Ambien tests/cases/compiler/privacyGloImportParseErrors.ts(30,20): error TS2435: Ambient external modules cannot be nested in other modules. tests/cases/compiler/privacyGloImportParseErrors.ts(59,37): error TS1147: Import declarations in an internal module cannot reference an external module. tests/cases/compiler/privacyGloImportParseErrors.ts(59,37): error TS2307: Cannot find external module 'm1_M3_public'. +tests/cases/compiler/privacyGloImportParseErrors.ts(69,37): error TS1147: Import declarations in an internal module cannot reference an external module. tests/cases/compiler/privacyGloImportParseErrors.ts(69,37): error TS2307: Cannot find external module 'm1_M4_private'. +tests/cases/compiler/privacyGloImportParseErrors.ts(81,43): error TS1147: Import declarations in an internal module cannot reference an external module. +tests/cases/compiler/privacyGloImportParseErrors.ts(82,43): error TS1147: Import declarations in an internal module cannot reference an external module. tests/cases/compiler/privacyGloImportParseErrors.ts(121,38): error TS1147: Import declarations in an internal module cannot reference an external module. +tests/cases/compiler/privacyGloImportParseErrors.ts(125,45): error TS1147: Import declarations in an internal module cannot reference an external module. tests/cases/compiler/privacyGloImportParseErrors.ts(133,9): error TS1038: A 'declare' modifier cannot be used in an already ambient context. tests/cases/compiler/privacyGloImportParseErrors.ts(133,24): error TS2435: Ambient external modules cannot be nested in other modules. tests/cases/compiler/privacyGloImportParseErrors.ts(138,16): error TS2435: Ambient external modules cannot be nested in other modules. tests/cases/compiler/privacyGloImportParseErrors.ts(141,12): error TS2435: Ambient external modules cannot be nested in other modules. tests/cases/compiler/privacyGloImportParseErrors.ts(146,25): error TS1147: Import declarations in an internal module cannot reference an external module. +tests/cases/compiler/privacyGloImportParseErrors.ts(149,29): error TS1147: Import declarations in an internal module cannot reference an external module. -==== tests/cases/compiler/privacyGloImportParseErrors.ts (11 errors) ==== +==== tests/cases/compiler/privacyGloImportParseErrors.ts (16 errors) ==== module m1 { export module m1_M1_public { export class c1 { @@ -90,6 +95,8 @@ tests/cases/compiler/privacyGloImportParseErrors.ts(146,25): error TS1147: Impor import m1_im4_private = require("m1_M4_private"); ~~~~~~~~~~~~~~~ +!!! error TS1147: Import declarations in an internal module cannot reference an external module. + ~~~~~~~~~~~~~~~ !!! error TS2307: Cannot find external module 'm1_M4_private'. export var m1_im4_private_v1_public = m1_im4_private.c1; export var m1_im4_private_v2_public = new m1_im4_private.c1(); @@ -103,7 +110,11 @@ tests/cases/compiler/privacyGloImportParseErrors.ts(146,25): error TS1147: Impor export import m1_im1_public = m1_M1_public; export import m1_im2_public = m1_M2_private; export import m1_im3_public = require("m1_M3_public"); + ~~~~~~~~~~~~~~ +!!! error TS1147: Import declarations in an internal module cannot reference an external module. export import m1_im4_public = require("m1_M4_private"); + ~~~~~~~~~~~~~~~ +!!! error TS1147: Import declarations in an internal module cannot reference an external module. } module glo_M1_public { @@ -149,6 +160,8 @@ tests/cases/compiler/privacyGloImportParseErrors.ts(146,25): error TS1147: Impor module m5 { import m5_errorImport = require("glo_M2_public"); + ~~~~~~~~~~~~~~~ +!!! error TS1147: Import declarations in an internal module cannot reference an external module. import m5_nonerrorImport = glo_M1_public; } } @@ -183,6 +196,8 @@ tests/cases/compiler/privacyGloImportParseErrors.ts(146,25): error TS1147: Impor module m4 { var a = 10; import m2 = require("use_glo_M1_public"); + ~~~~~~~~~~~~~~~~~~~ +!!! error TS1147: Import declarations in an internal module cannot reference an external module. } } \ No newline at end of file diff --git a/tests/baselines/reference/privacyImportParseErrors.errors.txt b/tests/baselines/reference/privacyImportParseErrors.errors.txt index 51199196ad7..a81bfbe738b 100644 --- a/tests/baselines/reference/privacyImportParseErrors.errors.txt +++ b/tests/baselines/reference/privacyImportParseErrors.errors.txt @@ -2,12 +2,18 @@ tests/cases/compiler/privacyImportParseErrors.ts(22,27): error TS2435: Ambient e tests/cases/compiler/privacyImportParseErrors.ts(30,20): error TS2435: Ambient external modules cannot be nested in other modules. tests/cases/compiler/privacyImportParseErrors.ts(59,37): error TS1147: Import declarations in an internal module cannot reference an external module. tests/cases/compiler/privacyImportParseErrors.ts(59,37): error TS2307: Cannot find external module 'm1_M3_public'. +tests/cases/compiler/privacyImportParseErrors.ts(69,37): error TS1147: Import declarations in an internal module cannot reference an external module. tests/cases/compiler/privacyImportParseErrors.ts(69,37): error TS2307: Cannot find external module 'm1_M4_private'. +tests/cases/compiler/privacyImportParseErrors.ts(81,43): error TS1147: Import declarations in an internal module cannot reference an external module. +tests/cases/compiler/privacyImportParseErrors.ts(82,43): error TS1147: Import declarations in an internal module cannot reference an external module. tests/cases/compiler/privacyImportParseErrors.ts(106,27): error TS2435: Ambient external modules cannot be nested in other modules. tests/cases/compiler/privacyImportParseErrors.ts(114,20): error TS2435: Ambient external modules cannot be nested in other modules. tests/cases/compiler/privacyImportParseErrors.ts(143,37): error TS1147: Import declarations in an internal module cannot reference an external module. tests/cases/compiler/privacyImportParseErrors.ts(143,37): error TS2307: Cannot find external module 'm2_M3_public'. +tests/cases/compiler/privacyImportParseErrors.ts(153,37): error TS1147: Import declarations in an internal module cannot reference an external module. tests/cases/compiler/privacyImportParseErrors.ts(153,37): error TS2307: Cannot find external module 'm2_M4_private'. +tests/cases/compiler/privacyImportParseErrors.ts(166,43): error TS1147: Import declarations in an internal module cannot reference an external module. +tests/cases/compiler/privacyImportParseErrors.ts(167,43): error TS1147: Import declarations in an internal module cannot reference an external module. tests/cases/compiler/privacyImportParseErrors.ts(180,23): error TS2435: Ambient external modules cannot be nested in other modules. tests/cases/compiler/privacyImportParseErrors.ts(198,23): error TS2435: Ambient external modules cannot be nested in other modules. tests/cases/compiler/privacyImportParseErrors.ts(218,34): error TS2307: Cannot find external module 'glo_M2_public'. @@ -19,11 +25,13 @@ tests/cases/compiler/privacyImportParseErrors.ts(258,45): error TS2304: Cannot f tests/cases/compiler/privacyImportParseErrors.ts(261,39): error TS2304: Cannot find name 'use_glo_M1_public'. tests/cases/compiler/privacyImportParseErrors.ts(264,40): error TS2307: Cannot find external module 'glo_M2_public'. tests/cases/compiler/privacyImportParseErrors.ts(273,38): error TS1147: Import declarations in an internal module cannot reference an external module. +tests/cases/compiler/privacyImportParseErrors.ts(277,45): error TS1147: Import declarations in an internal module cannot reference an external module. tests/cases/compiler/privacyImportParseErrors.ts(284,16): error TS2435: Ambient external modules cannot be nested in other modules. tests/cases/compiler/privacyImportParseErrors.ts(287,46): error TS2304: Cannot find name 'use_glo_M3_private'. tests/cases/compiler/privacyImportParseErrors.ts(290,40): error TS2304: Cannot find name 'use_glo_M3_private'. tests/cases/compiler/privacyImportParseErrors.ts(293,41): error TS2307: Cannot find external module 'glo_M4_private'. tests/cases/compiler/privacyImportParseErrors.ts(302,38): error TS1147: Import declarations in an internal module cannot reference an external module. +tests/cases/compiler/privacyImportParseErrors.ts(306,45): error TS1147: Import declarations in an internal module cannot reference an external module. tests/cases/compiler/privacyImportParseErrors.ts(312,16): error TS2435: Ambient external modules cannot be nested in other modules. tests/cases/compiler/privacyImportParseErrors.ts(314,9): error TS1038: A 'declare' modifier cannot be used in an already ambient context. tests/cases/compiler/privacyImportParseErrors.ts(314,24): error TS2435: Ambient external modules cannot be nested in other modules. @@ -31,14 +39,17 @@ tests/cases/compiler/privacyImportParseErrors.ts(319,16): error TS2435: Ambient tests/cases/compiler/privacyImportParseErrors.ts(322,12): error TS2435: Ambient external modules cannot be nested in other modules. tests/cases/compiler/privacyImportParseErrors.ts(326,9): error TS1029: 'export' modifier must precede 'declare' modifier. tests/cases/compiler/privacyImportParseErrors.ts(326,23): error TS2435: Ambient external modules cannot be nested in other modules. +tests/cases/compiler/privacyImportParseErrors.ts(328,9): error TS1038: A 'declare' modifier cannot be used in an already ambient context. tests/cases/compiler/privacyImportParseErrors.ts(328,24): error TS2435: Ambient external modules cannot be nested in other modules. tests/cases/compiler/privacyImportParseErrors.ts(333,16): error TS2435: Ambient external modules cannot be nested in other modules. tests/cases/compiler/privacyImportParseErrors.ts(336,12): error TS2435: Ambient external modules cannot be nested in other modules. tests/cases/compiler/privacyImportParseErrors.ts(341,25): error TS1147: Import declarations in an internal module cannot reference an external module. +tests/cases/compiler/privacyImportParseErrors.ts(344,29): error TS1147: Import declarations in an internal module cannot reference an external module. tests/cases/compiler/privacyImportParseErrors.ts(350,25): error TS1147: Import declarations in an internal module cannot reference an external module. +tests/cases/compiler/privacyImportParseErrors.ts(353,29): error TS1147: Import declarations in an internal module cannot reference an external module. -==== tests/cases/compiler/privacyImportParseErrors.ts (38 errors) ==== +==== tests/cases/compiler/privacyImportParseErrors.ts (49 errors) ==== export module m1 { export module m1_M1_public { export class c1 { @@ -117,6 +128,8 @@ tests/cases/compiler/privacyImportParseErrors.ts(350,25): error TS1147: Import d import m1_im4_private = require("m1_M4_private"); ~~~~~~~~~~~~~~~ +!!! error TS1147: Import declarations in an internal module cannot reference an external module. + ~~~~~~~~~~~~~~~ !!! error TS2307: Cannot find external module 'm1_M4_private'. export var m1_im4_private_v1_public = m1_im4_private.c1; export var m1_im4_private_v2_public = new m1_im4_private.c1(); @@ -130,7 +143,11 @@ tests/cases/compiler/privacyImportParseErrors.ts(350,25): error TS1147: Import d export import m1_im1_public = m1_M1_public; export import m1_im2_public = m1_M2_private; export import m1_im3_public = require("m1_M3_public"); + ~~~~~~~~~~~~~~ +!!! error TS1147: Import declarations in an internal module cannot reference an external module. export import m1_im4_public = require("m1_M4_private"); + ~~~~~~~~~~~~~~~ +!!! error TS1147: Import declarations in an internal module cannot reference an external module. } module m2 { @@ -211,6 +228,8 @@ tests/cases/compiler/privacyImportParseErrors.ts(350,25): error TS1147: Import d import m1_im4_private = require("m2_M4_private"); ~~~~~~~~~~~~~~~ +!!! error TS1147: Import declarations in an internal module cannot reference an external module. + ~~~~~~~~~~~~~~~ !!! error TS2307: Cannot find external module 'm2_M4_private'. export var m1_im4_private_v1_public = m1_im4_private.c1; export var m1_im4_private_v2_public = new m1_im4_private.c1(); @@ -225,7 +244,11 @@ tests/cases/compiler/privacyImportParseErrors.ts(350,25): error TS1147: Import d export import m1_im1_public = m2_M1_public; export import m1_im2_public = m2_M2_private; export import m1_im3_public = require("m2_M3_public"); + ~~~~~~~~~~~~~~ +!!! error TS1147: Import declarations in an internal module cannot reference an external module. export import m1_im4_public = require("m2_M4_private"); + ~~~~~~~~~~~~~~~ +!!! error TS1147: Import declarations in an internal module cannot reference an external module. } export module glo_M1_public { @@ -358,6 +381,8 @@ tests/cases/compiler/privacyImportParseErrors.ts(350,25): error TS1147: Import d module m5 { import m5_errorImport = require("glo_M2_public"); + ~~~~~~~~~~~~~~~ +!!! error TS1147: Import declarations in an internal module cannot reference an external module. import m5_nonerrorImport = glo_M1_public; } } @@ -397,6 +422,8 @@ tests/cases/compiler/privacyImportParseErrors.ts(350,25): error TS1147: Import d module m5 { import m5_errorImport = require("glo_M4_private"); + ~~~~~~~~~~~~~~~~ +!!! error TS1147: Import declarations in an internal module cannot reference an external module. import m5_nonerrorImport = glo_M3_private; } } @@ -433,6 +460,8 @@ tests/cases/compiler/privacyImportParseErrors.ts(350,25): error TS1147: Import d !!! error TS2435: Ambient external modules cannot be nested in other modules. module m2 { declare module "abc" { + ~~~~~~~ +!!! error TS1038: A 'declare' modifier cannot be used in an already ambient context. ~~~~~ !!! error TS2435: Ambient external modules cannot be nested in other modules. } @@ -457,6 +486,8 @@ tests/cases/compiler/privacyImportParseErrors.ts(350,25): error TS1147: Import d module m4 { var a = 10; import m2 = require("use_glo_M1_public"); + ~~~~~~~~~~~~~~~~~~~ +!!! error TS1147: Import declarations in an internal module cannot reference an external module. } } @@ -468,6 +499,8 @@ tests/cases/compiler/privacyImportParseErrors.ts(350,25): error TS1147: Import d module m4 { var a = 10; import m2 = require("use_glo_M1_public"); + ~~~~~~~~~~~~~~~~~~~ +!!! error TS1147: Import declarations in an internal module cannot reference an external module. } } \ No newline at end of file diff --git a/tests/baselines/reference/project/intReferencingExtAndInt/amd/intReferencingExtAndInt.errors.txt b/tests/baselines/reference/project/intReferencingExtAndInt/amd/intReferencingExtAndInt.errors.txt index fd808bc1443..bfc09e40188 100644 --- a/tests/baselines/reference/project/intReferencingExtAndInt/amd/intReferencingExtAndInt.errors.txt +++ b/tests/baselines/reference/project/intReferencingExtAndInt/amd/intReferencingExtAndInt.errors.txt @@ -1,11 +1,14 @@ internal2.ts(2,21): error TS1147: Import declarations in an internal module cannot reference an external module. +internal2.ts(2,21): error TS2307: Cannot find external module 'external2'. -==== internal2.ts (1 errors) ==== +==== internal2.ts (2 errors) ==== module outer { import g = require("external2") ~~~~~~~~~~~ !!! error TS1147: Import declarations in an internal module cannot reference an external module. + ~~~~~~~~~~~ +!!! error TS2307: Cannot find external module 'external2'. export var a = g.square(5); export var b = "foo"; } \ No newline at end of file diff --git a/tests/baselines/reference/project/intReferencingExtAndInt/node/intReferencingExtAndInt.errors.txt b/tests/baselines/reference/project/intReferencingExtAndInt/node/intReferencingExtAndInt.errors.txt index fd808bc1443..bfc09e40188 100644 --- a/tests/baselines/reference/project/intReferencingExtAndInt/node/intReferencingExtAndInt.errors.txt +++ b/tests/baselines/reference/project/intReferencingExtAndInt/node/intReferencingExtAndInt.errors.txt @@ -1,11 +1,14 @@ internal2.ts(2,21): error TS1147: Import declarations in an internal module cannot reference an external module. +internal2.ts(2,21): error TS2307: Cannot find external module 'external2'. -==== internal2.ts (1 errors) ==== +==== internal2.ts (2 errors) ==== module outer { import g = require("external2") ~~~~~~~~~~~ !!! error TS1147: Import declarations in an internal module cannot reference an external module. + ~~~~~~~~~~~ +!!! error TS2307: Cannot find external module 'external2'. export var a = g.square(5); export var b = "foo"; } \ No newline at end of file diff --git a/tests/baselines/reference/project/nestedLocalModuleWithRecursiveTypecheck/amd/nestedLocalModuleWithRecursiveTypecheck.errors.txt b/tests/baselines/reference/project/nestedLocalModuleWithRecursiveTypecheck/amd/nestedLocalModuleWithRecursiveTypecheck.errors.txt index 9d1540829fc..e205f308c0a 100644 --- a/tests/baselines/reference/project/nestedLocalModuleWithRecursiveTypecheck/amd/nestedLocalModuleWithRecursiveTypecheck.errors.txt +++ b/tests/baselines/reference/project/nestedLocalModuleWithRecursiveTypecheck/amd/nestedLocalModuleWithRecursiveTypecheck.errors.txt @@ -1,12 +1,15 @@ test1.ts(3,23): error TS1147: Import declarations in an internal module cannot reference an external module. +test1.ts(3,23): error TS2307: Cannot find external module 'test2'. -==== test1.ts (1 errors) ==== +==== test1.ts (2 errors) ==== module myModule { import foo = require("test2"); ~~~~~~~ !!! error TS1147: Import declarations in an internal module cannot reference an external module. + ~~~~~~~ +!!! error TS2307: Cannot find external module 'test2'. //console.log(foo.$); diff --git a/tests/baselines/reference/project/nestedLocalModuleWithRecursiveTypecheck/node/nestedLocalModuleWithRecursiveTypecheck.errors.txt b/tests/baselines/reference/project/nestedLocalModuleWithRecursiveTypecheck/node/nestedLocalModuleWithRecursiveTypecheck.errors.txt index 9d1540829fc..e205f308c0a 100644 --- a/tests/baselines/reference/project/nestedLocalModuleWithRecursiveTypecheck/node/nestedLocalModuleWithRecursiveTypecheck.errors.txt +++ b/tests/baselines/reference/project/nestedLocalModuleWithRecursiveTypecheck/node/nestedLocalModuleWithRecursiveTypecheck.errors.txt @@ -1,12 +1,15 @@ test1.ts(3,23): error TS1147: Import declarations in an internal module cannot reference an external module. +test1.ts(3,23): error TS2307: Cannot find external module 'test2'. -==== test1.ts (1 errors) ==== +==== test1.ts (2 errors) ==== module myModule { import foo = require("test2"); ~~~~~~~ !!! error TS1147: Import declarations in an internal module cannot reference an external module. + ~~~~~~~ +!!! error TS2307: Cannot find external module 'test2'. //console.log(foo.$); diff --git a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/amd/privacyCheckOnImportedModuleDeclarationsInsideModule.errors.txt b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/amd/privacyCheckOnImportedModuleDeclarationsInsideModule.errors.txt index f15b4d3379b..eabc4e5656a 100644 --- a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/amd/privacyCheckOnImportedModuleDeclarationsInsideModule.errors.txt +++ b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/amd/privacyCheckOnImportedModuleDeclarationsInsideModule.errors.txt @@ -1,11 +1,16 @@ testGlo.ts(2,39): error TS1147: Import declarations in an internal module cannot reference an external module. +testGlo.ts(2,39): error TS2307: Cannot find external module 'mExported'. +testGlo.ts(21,35): error TS1147: Import declarations in an internal module cannot reference an external module. +testGlo.ts(21,35): error TS2307: Cannot find external module 'mNonExported'. -==== testGlo.ts (1 errors) ==== +==== testGlo.ts (4 errors) ==== module m2 { export import mExported = require("mExported"); ~~~~~~~~~~~ !!! error TS1147: Import declarations in an internal module cannot reference an external module. + ~~~~~~~~~~~ +!!! error TS2307: Cannot find external module 'mExported'. export var c1 = new mExported.me.class1; export function f1() { return new mExported.me.class1(); @@ -25,6 +30,10 @@ testGlo.ts(2,39): error TS1147: Import declarations in an internal module cannot } import mNonExported = require("mNonExported"); + ~~~~~~~~~~~~~~ +!!! error TS1147: Import declarations in an internal module cannot reference an external module. + ~~~~~~~~~~~~~~ +!!! error TS2307: Cannot find external module 'mNonExported'. export var c3 = new mNonExported.mne.class1; export function f3() { return new mNonExported.mne.class1(); diff --git a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/node/privacyCheckOnImportedModuleDeclarationsInsideModule.errors.txt b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/node/privacyCheckOnImportedModuleDeclarationsInsideModule.errors.txt index f15b4d3379b..eabc4e5656a 100644 --- a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/node/privacyCheckOnImportedModuleDeclarationsInsideModule.errors.txt +++ b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/node/privacyCheckOnImportedModuleDeclarationsInsideModule.errors.txt @@ -1,11 +1,16 @@ testGlo.ts(2,39): error TS1147: Import declarations in an internal module cannot reference an external module. +testGlo.ts(2,39): error TS2307: Cannot find external module 'mExported'. +testGlo.ts(21,35): error TS1147: Import declarations in an internal module cannot reference an external module. +testGlo.ts(21,35): error TS2307: Cannot find external module 'mNonExported'. -==== testGlo.ts (1 errors) ==== +==== testGlo.ts (4 errors) ==== module m2 { export import mExported = require("mExported"); ~~~~~~~~~~~ !!! error TS1147: Import declarations in an internal module cannot reference an external module. + ~~~~~~~~~~~ +!!! error TS2307: Cannot find external module 'mExported'. export var c1 = new mExported.me.class1; export function f1() { return new mExported.me.class1(); @@ -25,6 +30,10 @@ testGlo.ts(2,39): error TS1147: Import declarations in an internal module cannot } import mNonExported = require("mNonExported"); + ~~~~~~~~~~~~~~ +!!! error TS1147: Import declarations in an internal module cannot reference an external module. + ~~~~~~~~~~~~~~ +!!! error TS2307: Cannot find external module 'mNonExported'. export var c3 = new mNonExported.mne.class1; export function f3() { return new mNonExported.mne.class1(); diff --git a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule/amd/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule.errors.txt b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule/amd/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule.errors.txt index 8589da5c54d..820d18ffb98 100644 --- a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule/amd/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule.errors.txt +++ b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule/amd/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule.errors.txt @@ -1,7 +1,10 @@ test.ts(5,39): error TS1147: Import declarations in an internal module cannot reference an external module. +test.ts(5,39): error TS2307: Cannot find external module 'mExported'. +test.ts(24,35): error TS1147: Import declarations in an internal module cannot reference an external module. +test.ts(24,35): error TS2307: Cannot find external module 'mNonExported'. -==== test.ts (1 errors) ==== +==== test.ts (4 errors) ==== export module m1 { } @@ -9,6 +12,8 @@ test.ts(5,39): error TS1147: Import declarations in an internal module cannot re export import mExported = require("mExported"); ~~~~~~~~~~~ !!! error TS1147: Import declarations in an internal module cannot reference an external module. + ~~~~~~~~~~~ +!!! error TS2307: Cannot find external module 'mExported'. export var c1 = new mExported.me.class1; export function f1() { return new mExported.me.class1(); @@ -28,6 +33,10 @@ test.ts(5,39): error TS1147: Import declarations in an internal module cannot re } import mNonExported = require("mNonExported"); + ~~~~~~~~~~~~~~ +!!! error TS1147: Import declarations in an internal module cannot reference an external module. + ~~~~~~~~~~~~~~ +!!! error TS2307: Cannot find external module 'mNonExported'. export var c3 = new mNonExported.mne.class1; export function f3() { return new mNonExported.mne.class1(); diff --git a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule/node/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule.errors.txt b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule/node/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule.errors.txt index 8589da5c54d..820d18ffb98 100644 --- a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule/node/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule.errors.txt +++ b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule/node/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule.errors.txt @@ -1,7 +1,10 @@ test.ts(5,39): error TS1147: Import declarations in an internal module cannot reference an external module. +test.ts(5,39): error TS2307: Cannot find external module 'mExported'. +test.ts(24,35): error TS1147: Import declarations in an internal module cannot reference an external module. +test.ts(24,35): error TS2307: Cannot find external module 'mNonExported'. -==== test.ts (1 errors) ==== +==== test.ts (4 errors) ==== export module m1 { } @@ -9,6 +12,8 @@ test.ts(5,39): error TS1147: Import declarations in an internal module cannot re export import mExported = require("mExported"); ~~~~~~~~~~~ !!! error TS1147: Import declarations in an internal module cannot reference an external module. + ~~~~~~~~~~~ +!!! error TS2307: Cannot find external module 'mExported'. export var c1 = new mExported.me.class1; export function f1() { return new mExported.me.class1(); @@ -28,6 +33,10 @@ test.ts(5,39): error TS1147: Import declarations in an internal module cannot re } import mNonExported = require("mNonExported"); + ~~~~~~~~~~~~~~ +!!! error TS1147: Import declarations in an internal module cannot reference an external module. + ~~~~~~~~~~~~~~ +!!! error TS2307: Cannot find external module 'mNonExported'. export var c3 = new mNonExported.mne.class1; export function f3() { return new mNonExported.mne.class1(); diff --git a/tests/baselines/reference/project/privacyCheckOnImportedModuleImportStatementInParentModule/amd/privacyCheckOnImportedModuleImportStatementInParentModule.errors.txt b/tests/baselines/reference/project/privacyCheckOnImportedModuleImportStatementInParentModule/amd/privacyCheckOnImportedModuleImportStatementInParentModule.errors.txt index c3c3a11c8b2..ed865949b87 100644 --- a/tests/baselines/reference/project/privacyCheckOnImportedModuleImportStatementInParentModule/amd/privacyCheckOnImportedModuleImportStatementInParentModule.errors.txt +++ b/tests/baselines/reference/project/privacyCheckOnImportedModuleImportStatementInParentModule/amd/privacyCheckOnImportedModuleImportStatementInParentModule.errors.txt @@ -1,11 +1,16 @@ test.ts(2,39): error TS1147: Import declarations in an internal module cannot reference an external module. +test.ts(2,39): error TS2307: Cannot find external module 'mExported'. +test.ts(42,35): error TS1147: Import declarations in an internal module cannot reference an external module. +test.ts(42,35): error TS2307: Cannot find external module 'mNonExported'. -==== test.ts (1 errors) ==== +==== test.ts (4 errors) ==== export module m2 { export import mExported = require("mExported"); ~~~~~~~~~~~ !!! error TS1147: Import declarations in an internal module cannot reference an external module. + ~~~~~~~~~~~ +!!! error TS2307: Cannot find external module 'mExported'. module Internal_M1 { export var c1 = new mExported.me.class1; @@ -46,6 +51,10 @@ test.ts(2,39): error TS1147: Import declarations in an internal module cannot re } import mNonExported = require("mNonExported"); + ~~~~~~~~~~~~~~ +!!! error TS1147: Import declarations in an internal module cannot reference an external module. + ~~~~~~~~~~~~~~ +!!! error TS2307: Cannot find external module 'mNonExported'. module Internal_M3 { export var c3 = new mNonExported.mne.class1; export function f3() { diff --git a/tests/baselines/reference/project/privacyCheckOnImportedModuleImportStatementInParentModule/node/privacyCheckOnImportedModuleImportStatementInParentModule.errors.txt b/tests/baselines/reference/project/privacyCheckOnImportedModuleImportStatementInParentModule/node/privacyCheckOnImportedModuleImportStatementInParentModule.errors.txt index c3c3a11c8b2..ed865949b87 100644 --- a/tests/baselines/reference/project/privacyCheckOnImportedModuleImportStatementInParentModule/node/privacyCheckOnImportedModuleImportStatementInParentModule.errors.txt +++ b/tests/baselines/reference/project/privacyCheckOnImportedModuleImportStatementInParentModule/node/privacyCheckOnImportedModuleImportStatementInParentModule.errors.txt @@ -1,11 +1,16 @@ test.ts(2,39): error TS1147: Import declarations in an internal module cannot reference an external module. +test.ts(2,39): error TS2307: Cannot find external module 'mExported'. +test.ts(42,35): error TS1147: Import declarations in an internal module cannot reference an external module. +test.ts(42,35): error TS2307: Cannot find external module 'mNonExported'. -==== test.ts (1 errors) ==== +==== test.ts (4 errors) ==== export module m2 { export import mExported = require("mExported"); ~~~~~~~~~~~ !!! error TS1147: Import declarations in an internal module cannot reference an external module. + ~~~~~~~~~~~ +!!! error TS2307: Cannot find external module 'mExported'. module Internal_M1 { export var c1 = new mExported.me.class1; @@ -46,6 +51,10 @@ test.ts(2,39): error TS1147: Import declarations in an internal module cannot re } import mNonExported = require("mNonExported"); + ~~~~~~~~~~~~~~ +!!! error TS1147: Import declarations in an internal module cannot reference an external module. + ~~~~~~~~~~~~~~ +!!! error TS2307: Cannot find external module 'mNonExported'. module Internal_M3 { export var c3 = new mNonExported.mne.class1; export function f3() { diff --git a/tests/baselines/reference/semicolonsInModuleDeclarations.errors.txt b/tests/baselines/reference/semicolonsInModuleDeclarations.errors.txt index 64b95f124a6..920d5007509 100644 --- a/tests/baselines/reference/semicolonsInModuleDeclarations.errors.txt +++ b/tests/baselines/reference/semicolonsInModuleDeclarations.errors.txt @@ -1,13 +1,10 @@ tests/cases/compiler/semicolonsInModuleDeclarations.ts(2,27): error TS1036: Statements are not allowed in ambient contexts. -tests/cases/compiler/semicolonsInModuleDeclarations.ts(2,27): error TS1036: Statements are not allowed in ambient contexts. -==== tests/cases/compiler/semicolonsInModuleDeclarations.ts (2 errors) ==== +==== tests/cases/compiler/semicolonsInModuleDeclarations.ts (1 errors) ==== declare module ambiModule { export interface i1 { }; ~ -!!! error TS1036: Statements are not allowed in ambient contexts. - ~ !!! error TS1036: Statements are not allowed in ambient contexts. export interface i2 { } }