diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 0d2575401c7..cd9db15c7fa 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -8345,12 +8345,12 @@ module ts { // class C { // foo(x: public){} // Error. // } - if (node.typeName.kind === SyntaxKind.Identifier && (node.typeName).strictModeKind) { + if (node.typeName.kind === SyntaxKind.Identifier && (node.typeName).isKeywordInStrictMode) { let typeName = node.typeName; let nameText = declarationNameToString(typeName); - reportStrictModeGrammarErrorInClassDeclaration(typeName, Diagnostics.Type_expected_0_is_a_reserved_word_Class_definitions_are_automatically_in_strict_mode, nameText) || - reportStrictModeGrammarErrorInModule(typeName, Diagnostics.Type_expected_0_is_a_reserved_word_Module_is_automatically_in_strict_mode, nameText) || - grammarErrorOnNode(typeName, Diagnostics.Type_expected_0_is_a_reserved_word_in_strict_mode, nameText); + reportStrictModeGrammarErrorInClassDeclaration(typeName, Diagnostics.Type_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode, nameText) || + reportStrictModeGrammarErrorInModule(typeName, Diagnostics.Type_expected_0_is_a_reserved_word_in_strict_mode_Module_is_automatically_in_strict_mode, nameText) || + grammarErrorOnNode(typeName, Diagnostics.Type_expected_0_is_a_reserved_word_in_strict_mode, nameText); } return checkTypeReferenceOrHeritageClauseElement(node); } @@ -11960,7 +11960,7 @@ module ts { let nameBindings = impotClause.namedBindings; if (nameBindings.kind === SyntaxKind.NamespaceImport) { let name = (nameBindings).name; - if (name.strictModeKind) { + if (name.isKeywordInStrictMode) { let nameText = declarationNameToString(name); return grammarErrorOnNode(name, Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode, nameText); } @@ -11969,7 +11969,7 @@ module ts { let reportError = false; for (let element of (nameBindings).elements) { let name = element.name; - if (name.strictModeKind) { + if (name.isKeywordInStrictMode) { let nameText = declarationNameToString(name); reportError = grammarErrorOnNode(name, Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode, nameText); } @@ -11983,7 +11983,7 @@ module ts { function checkGrammarDeclarationNameInStrictMode(node: Declaration): boolean { let name = node.name; - if (name && name.kind === SyntaxKind.Identifier && (name).strictModeKind) { + if (name && name.kind === SyntaxKind.Identifier && (name).isKeywordInStrictMode) { let nameText = declarationNameToString(name); switch (node.kind) { case SyntaxKind.Parameter: @@ -11994,18 +11994,18 @@ module ts { case SyntaxKind.InterfaceDeclaration: case SyntaxKind.TypeAliasDeclaration: case SyntaxKind.EnumDeclaration: - let reportError = reportStrictModeGrammarErrorInClassDeclaration(name, Diagnostics.Identifier_expected_0_is_a_reserved_word_Class_definitions_are_automatically_in_strict_mode, nameText) || - reportStrictModeGrammarErrorInModule(name, Diagnostics.Identifier_expected_0_is_a_reserved_word_Module_is_automatically_in_strict_mode, nameText) || + let reportError = reportStrictModeGrammarErrorInClassDeclaration(name, Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode, nameText) || + reportStrictModeGrammarErrorInModule(name, Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Module_is_automatically_in_strict_mode, nameText) || grammarErrorOnNode(name, Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode, nameText); return reportError ? reportError : false; case SyntaxKind.ClassDeclaration: // Report an error if the class declaration uses strict-mode reserved word. - return grammarErrorOnNode(name, Diagnostics.Identifier_expected_0_is_a_reserved_word_Class_definitions_are_automatically_in_strict_mode, nameText); + return grammarErrorOnNode(name, Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode, nameText); case SyntaxKind.ModuleDeclaration: // Report an error if the module declaration uses strict-mode reserved word. - return grammarErrorOnNode(name, Diagnostics.Identifier_expected_0_is_a_reserved_word_Module_is_automatically_in_strict_mode, nameText); + return grammarErrorOnNode(name, Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Module_is_automatically_in_strict_mode, nameText); case SyntaxKind.ImportEqualsDeclaration: return grammarErrorOnNode(name, Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode, nameText); @@ -12015,7 +12015,7 @@ module ts { } function checkGrammarExpressionInStrictMode(node: Expression): boolean { - if (node.kind === SyntaxKind.Identifier && (node).strictModeKind) { + if (node.kind === SyntaxKind.Identifier && (node).isKeywordInStrictMode) { let nameText = declarationNameToString(node); return grammarErrorOnNode(node, Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode, nameText); } diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 5f36f90d60a..171413a19df 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -170,11 +170,11 @@ module ts { Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode: { code: 1210, category: DiagnosticCategory.Error, key: "Invalid use of '{0}'. Class definitions are automatically in strict mode." }, A_class_declaration_without_the_default_modifier_must_have_a_name: { code: 1211, category: DiagnosticCategory.Error, key: "A class declaration without the 'default' modifier must have a name" }, Identifier_expected_0_is_a_reserved_word_in_strict_mode: { code: 1212, category: DiagnosticCategory.Error, key: "Identifier expected. '{0}' is a reserved word in strict mode" }, - Identifier_expected_0_is_a_reserved_word_Class_definitions_are_automatically_in_strict_mode: { code: 1213, category: DiagnosticCategory.Error, key: "Identifier expected. '{0}' is a reserved word. Class definitions are automatically in strict mode." }, - Identifier_expected_0_is_a_reserved_word_Module_is_automatically_in_strict_mode: { code: 1214, category: DiagnosticCategory.Error, key: "Identifier expected. '{0}' is a reserved word. Module is automatically in strict mode." }, + Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode: { code: 1213, category: DiagnosticCategory.Error, key: "Identifier expected. '{0}' is a reserved word in strict mode. Class definitions are automatically in strict mode." }, + Identifier_expected_0_is_a_reserved_word_in_strict_mode_Module_is_automatically_in_strict_mode: { code: 1214, category: DiagnosticCategory.Error, key: "Identifier expected. '{0}' is a reserved word in strict mode. Module is automatically in strict mode." }, Type_expected_0_is_a_reserved_word_in_strict_mode: { code: 1215, category: DiagnosticCategory.Error, key: "Type expected. '{0}' is a reserved word in strict mode" }, - Type_expected_0_is_a_reserved_word_Class_definitions_are_automatically_in_strict_mode: { code: 1216, category: DiagnosticCategory.Error, key: "Type expected. '{0}' is a reserved word. Class definitions are automatically in strict mode." }, - Type_expected_0_is_a_reserved_word_Module_is_automatically_in_strict_mode: { code: 1217, category: DiagnosticCategory.Error, key: "Type expected. '{0}' is a reserved word. Module is automatically in strict mode." }, + Type_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode: { code: 1216, category: DiagnosticCategory.Error, key: "Type expected. '{0}' is a reserved word in strict mode. Class definitions are automatically in strict mode." }, + Type_expected_0_is_a_reserved_word_in_strict_mode_Module_is_automatically_in_strict_mode: { code: 1217, category: DiagnosticCategory.Error, key: "Type expected. '{0}' is a reserved word in strict mode. Module is automatically in strict mode." }, Duplicate_identifier_0: { code: 2300, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: DiagnosticCategory.Error, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, Static_members_cannot_reference_class_type_parameters: { code: 2302, category: DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 61726910846..32c289a6d23 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -671,11 +671,11 @@ "category": "Error", "code": 1212 }, - "Identifier expected. '{0}' is a reserved word. Class definitions are automatically in strict mode.": { + "Identifier expected. '{0}' is a reserved word in strict mode. Class definitions are automatically in strict mode.": { "category": "Error", "code": 1213 }, - "Identifier expected. '{0}' is a reserved word. Module is automatically in strict mode.": { + "Identifier expected. '{0}' is a reserved word in strict mode. Module is automatically in strict mode.": { "category": "Error", "code": 1214 }, @@ -683,11 +683,11 @@ "category": "Error", "code": 1215 }, - "Type expected. '{0}' is a reserved word. Class definitions are automatically in strict mode.": { + "Type expected. '{0}' is a reserved word in strict mode. Class definitions are automatically in strict mode.": { "category": "Error", "code": 1216 }, - "Type expected. '{0}' is a reserved word. Module is automatically in strict mode.": { + "Type expected. '{0}' is a reserved word in strict mode. Module is automatically in strict mode.": { "category": "Error", "code": 1217 }, diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index e70090abd80..0edb44dc26a 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -1489,7 +1489,7 @@ module ts { // Set strictModeKind property so that we can report appropriate error later in type checker if (inStrictModeContext() && (token > SyntaxKind.Identifier && token <= SyntaxKind.LastFutureReservedWord)) { - node.strictModeKind = token; + node.isKeywordInStrictMode = token; } node.text = internIdentifier(scanner.getTokenValue()); nextToken(); diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 01b4003c0e1..a3e6afbeb17 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -387,7 +387,7 @@ module ts { export interface Identifier extends PrimaryExpression { text: string; // Text of identifier (with escapes converted to characters) - strictModeKind?: SyntaxKind; // SyntaxKind set when violating strict mode reserved word + isKeywordInStrictMode?: SyntaxKind; // SyntaxKind which get set when violating strict mode reserved word } export interface QualifiedName extends Node { diff --git a/tests/baselines/reference/constructorStaticParamName.errors.txt b/tests/baselines/reference/constructorStaticParamName.errors.txt index 36ee447e4e8..bd5012d00c1 100644 --- a/tests/baselines/reference/constructorStaticParamName.errors.txt +++ b/tests/baselines/reference/constructorStaticParamName.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/constructorStaticParamName.ts(4,18): error TS1213: Identifier expected. 'static' is a reserved word. Class definitions are automatically in strict mode. +tests/cases/compiler/constructorStaticParamName.ts(4,18): error TS1213: Identifier expected. 'static' is a reserved word in strict mode. Class definitions are automatically in strict mode. ==== tests/cases/compiler/constructorStaticParamName.ts (1 errors) ==== @@ -7,6 +7,6 @@ tests/cases/compiler/constructorStaticParamName.ts(4,18): error TS1213: Identifi class test { constructor (static) { } ~~~~~~ -!!! error TS1213: Identifier expected. 'static' is a reserved word. Class definitions are automatically in strict mode. +!!! error TS1213: Identifier expected. 'static' is a reserved word in strict mode. Class definitions are automatically in strict mode. } \ No newline at end of file diff --git a/tests/baselines/reference/constructorStaticParamNameErrors.errors.txt b/tests/baselines/reference/constructorStaticParamNameErrors.errors.txt index cd49422e7d5..847bb575a98 100644 --- a/tests/baselines/reference/constructorStaticParamNameErrors.errors.txt +++ b/tests/baselines/reference/constructorStaticParamNameErrors.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/constructorStaticParamNameErrors.ts(4,18): error TS1213: Identifier expected. 'static' is a reserved word. Class definitions are automatically in strict mode. +tests/cases/compiler/constructorStaticParamNameErrors.ts(4,18): error TS1213: Identifier expected. 'static' is a reserved word in strict mode. Class definitions are automatically in strict mode. ==== tests/cases/compiler/constructorStaticParamNameErrors.ts (1 errors) ==== @@ -7,5 +7,5 @@ tests/cases/compiler/constructorStaticParamNameErrors.ts(4,18): error TS1213: Id class test { constructor (static) { } ~~~~~~ -!!! error TS1213: Identifier expected. 'static' is a reserved word. Class definitions are automatically in strict mode. +!!! error TS1213: Identifier expected. 'static' is a reserved word in strict mode. Class definitions are automatically in strict mode. } \ No newline at end of file diff --git a/tests/baselines/reference/convertKeywordsYes.errors.txt b/tests/baselines/reference/convertKeywordsYes.errors.txt index dcecdacd776..7218e1fd12c 100644 --- a/tests/baselines/reference/convertKeywordsYes.errors.txt +++ b/tests/baselines/reference/convertKeywordsYes.errors.txt @@ -1,12 +1,12 @@ -tests/cases/compiler/convertKeywordsYes.ts(292,11): error TS1213: Identifier expected. 'implements' is a reserved word. Class definitions are automatically in strict mode. -tests/cases/compiler/convertKeywordsYes.ts(293,11): error TS1213: Identifier expected. 'interface' is a reserved word. Class definitions are automatically in strict mode. -tests/cases/compiler/convertKeywordsYes.ts(294,11): error TS1213: Identifier expected. 'let' is a reserved word. Class definitions are automatically in strict mode. -tests/cases/compiler/convertKeywordsYes.ts(296,11): error TS1213: Identifier expected. 'package' is a reserved word. Class definitions are automatically in strict mode. -tests/cases/compiler/convertKeywordsYes.ts(297,11): error TS1213: Identifier expected. 'private' is a reserved word. Class definitions are automatically in strict mode. -tests/cases/compiler/convertKeywordsYes.ts(298,11): error TS1213: Identifier expected. 'protected' is a reserved word. Class definitions are automatically in strict mode. -tests/cases/compiler/convertKeywordsYes.ts(299,11): error TS1213: Identifier expected. 'public' is a reserved word. Class definitions are automatically in strict mode. -tests/cases/compiler/convertKeywordsYes.ts(301,11): error TS1213: Identifier expected. 'static' is a reserved word. Class definitions are automatically in strict mode. -tests/cases/compiler/convertKeywordsYes.ts(303,11): error TS1213: Identifier expected. 'yield' is a reserved word. Class definitions are automatically in strict mode. +tests/cases/compiler/convertKeywordsYes.ts(292,11): error TS1213: Identifier expected. 'implements' is a reserved word in strict mode. Class definitions are automatically in strict mode. +tests/cases/compiler/convertKeywordsYes.ts(293,11): error TS1213: Identifier expected. 'interface' is a reserved word in strict mode. Class definitions are automatically in strict mode. +tests/cases/compiler/convertKeywordsYes.ts(294,11): error TS1213: Identifier expected. 'let' is a reserved word in strict mode. Class definitions are automatically in strict mode. +tests/cases/compiler/convertKeywordsYes.ts(296,11): error TS1213: Identifier expected. 'package' is a reserved word in strict mode. Class definitions are automatically in strict mode. +tests/cases/compiler/convertKeywordsYes.ts(297,11): error TS1213: Identifier expected. 'private' is a reserved word in strict mode. Class definitions are automatically in strict mode. +tests/cases/compiler/convertKeywordsYes.ts(298,11): error TS1213: Identifier expected. 'protected' is a reserved word in strict mode. Class definitions are automatically in strict mode. +tests/cases/compiler/convertKeywordsYes.ts(299,11): error TS1213: Identifier expected. 'public' is a reserved word in strict mode. Class definitions are automatically in strict mode. +tests/cases/compiler/convertKeywordsYes.ts(301,11): error TS1213: Identifier expected. 'static' is a reserved word in strict mode. Class definitions are automatically in strict mode. +tests/cases/compiler/convertKeywordsYes.ts(303,11): error TS1213: Identifier expected. 'yield' is a reserved word in strict mode. Class definitions are automatically in strict mode. ==== tests/cases/compiler/convertKeywordsYes.ts (9 errors) ==== @@ -303,33 +303,33 @@ tests/cases/compiler/convertKeywordsYes.ts(303,11): error TS1213: Identifier exp class constructor { } class implements { } ~~~~~~~~~~ -!!! error TS1213: Identifier expected. 'implements' is a reserved word. Class definitions are automatically in strict mode. +!!! error TS1213: Identifier expected. 'implements' is a reserved word in strict mode. Class definitions are automatically in strict mode. class interface { } ~~~~~~~~~ -!!! error TS1213: Identifier expected. 'interface' is a reserved word. Class definitions are automatically in strict mode. +!!! error TS1213: Identifier expected. 'interface' is a reserved word in strict mode. Class definitions are automatically in strict mode. class let { } ~~~ -!!! error TS1213: Identifier expected. 'let' is a reserved word. Class definitions are automatically in strict mode. +!!! error TS1213: Identifier expected. 'let' is a reserved word in strict mode. Class definitions are automatically in strict mode. class module { } class package { } ~~~~~~~ -!!! error TS1213: Identifier expected. 'package' is a reserved word. Class definitions are automatically in strict mode. +!!! error TS1213: Identifier expected. 'package' is a reserved word in strict mode. Class definitions are automatically in strict mode. class private { } ~~~~~~~ -!!! error TS1213: Identifier expected. 'private' is a reserved word. Class definitions are automatically in strict mode. +!!! error TS1213: Identifier expected. 'private' is a reserved word in strict mode. Class definitions are automatically in strict mode. class protected { } ~~~~~~~~~ -!!! error TS1213: Identifier expected. 'protected' is a reserved word. Class definitions are automatically in strict mode. +!!! error TS1213: Identifier expected. 'protected' is a reserved word in strict mode. Class definitions are automatically in strict mode. class public { } ~~~~~~ -!!! error TS1213: Identifier expected. 'public' is a reserved word. Class definitions are automatically in strict mode. +!!! error TS1213: Identifier expected. 'public' is a reserved word in strict mode. Class definitions are automatically in strict mode. class set { } class static { } ~~~~~~ -!!! error TS1213: Identifier expected. 'static' is a reserved word. Class definitions are automatically in strict mode. +!!! error TS1213: Identifier expected. 'static' is a reserved word in strict mode. Class definitions are automatically in strict mode. class get { } class yield { } ~~~~~ -!!! error TS1213: Identifier expected. 'yield' is a reserved word. Class definitions are automatically in strict mode. +!!! error TS1213: Identifier expected. 'yield' is a reserved word in strict mode. Class definitions are automatically in strict mode. class declare { } } \ No newline at end of file diff --git a/tests/baselines/reference/parser553699.errors.txt b/tests/baselines/reference/parser553699.errors.txt index f526629b7b6..ea7e88cdf36 100644 --- a/tests/baselines/reference/parser553699.errors.txt +++ b/tests/baselines/reference/parser553699.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/RegressionTests/parser553699.ts(3,21): error TS1216: Type expected. 'public' is a reserved word. Class definitions are automatically in strict mode. +tests/cases/conformance/parser/ecmascript5/RegressionTests/parser553699.ts(3,21): error TS1216: Type expected. 'public' is a reserved word in strict mode. Class definitions are automatically in strict mode. tests/cases/conformance/parser/ecmascript5/RegressionTests/parser553699.ts(3,21): error TS2304: Cannot find name 'public'. @@ -7,7 +7,7 @@ tests/cases/conformance/parser/ecmascript5/RegressionTests/parser553699.ts(3,21) constructor() { } public banana (x: public) { } ~~~~~~ -!!! error TS1216: Type expected. 'public' is a reserved word. Class definitions are automatically in strict mode. +!!! error TS1216: Type expected. 'public' is a reserved word in strict mode. Class definitions are automatically in strict mode. ~~~~~~ !!! error TS2304: Cannot find name 'public'. } diff --git a/tests/baselines/reference/parser642331.errors.txt b/tests/baselines/reference/parser642331.errors.txt index 5d7db637653..acff017d0ba 100644 --- a/tests/baselines/reference/parser642331.errors.txt +++ b/tests/baselines/reference/parser642331.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/parser/ecmascript5/RegressionTests/parser642331.ts(2,18): error TS1213: Identifier expected. 'static' is a reserved word. Class definitions are automatically in strict mode. +tests/cases/conformance/parser/ecmascript5/RegressionTests/parser642331.ts(2,18): error TS1213: Identifier expected. 'static' is a reserved word in strict mode. Class definitions are automatically in strict mode. ==== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser642331.ts (1 errors) ==== class test { constructor (static) { } ~~~~~~ -!!! error TS1213: Identifier expected. 'static' is a reserved word. Class definitions are automatically in strict mode. +!!! error TS1213: Identifier expected. 'static' is a reserved word in strict mode. Class definitions are automatically in strict mode. } \ No newline at end of file diff --git a/tests/baselines/reference/parser642331_1.errors.txt b/tests/baselines/reference/parser642331_1.errors.txt index be6fa63ee7c..fe01123f865 100644 --- a/tests/baselines/reference/parser642331_1.errors.txt +++ b/tests/baselines/reference/parser642331_1.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/RegressionTests/parser642331_1.ts(4,18): error TS1213: Identifier expected. 'static' is a reserved word. Class definitions are automatically in strict mode. +tests/cases/conformance/parser/ecmascript5/RegressionTests/parser642331_1.ts(4,18): error TS1213: Identifier expected. 'static' is a reserved word in strict mode. Class definitions are automatically in strict mode. ==== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser642331_1.ts (1 errors) ==== @@ -7,6 +7,6 @@ tests/cases/conformance/parser/ecmascript5/RegressionTests/parser642331_1.ts(4,1 class test { constructor (static) { } ~~~~~~ -!!! error TS1213: Identifier expected. 'static' is a reserved word. Class definitions are automatically in strict mode. +!!! error TS1213: Identifier expected. 'static' is a reserved word in strict mode. Class definitions are automatically in strict mode. } \ No newline at end of file diff --git a/tests/baselines/reference/strictModeCode1.errors.txt b/tests/baselines/reference/strictModeCode1.errors.txt index 8cc66072c4b..13b9d87854f 100644 --- a/tests/baselines/reference/strictModeCode1.errors.txt +++ b/tests/baselines/reference/strictModeCode1.errors.txt @@ -1,18 +1,18 @@ -tests/cases/compiler/strictModeCode1.ts(4,17): error TS1213: Identifier expected. 'private' is a reserved word. Class definitions are automatically in strict mode. -tests/cases/compiler/strictModeCode1.ts(4,26): error TS1213: Identifier expected. 'public' is a reserved word. Class definitions are automatically in strict mode. -tests/cases/compiler/strictModeCode1.ts(4,34): error TS1213: Identifier expected. 'static' is a reserved word. Class definitions are automatically in strict mode. +tests/cases/compiler/strictModeCode1.ts(4,17): error TS1213: Identifier expected. 'private' is a reserved word in strict mode. Class definitions are automatically in strict mode. +tests/cases/compiler/strictModeCode1.ts(4,26): error TS1213: Identifier expected. 'public' is a reserved word in strict mode. Class definitions are automatically in strict mode. +tests/cases/compiler/strictModeCode1.ts(4,34): error TS1213: Identifier expected. 'static' is a reserved word in strict mode. Class definitions are automatically in strict mode. tests/cases/compiler/strictModeCode1.ts(5,9): error TS1212: Identifier expected. 'private' is a reserved word in strict mode tests/cases/compiler/strictModeCode1.ts(5,19): error TS1212: Identifier expected. 'public' is a reserved word in strict mode tests/cases/compiler/strictModeCode1.ts(5,28): error TS1212: Identifier expected. 'static' is a reserved word in strict mode -tests/cases/compiler/strictModeCode1.ts(7,22): error TS1216: Type expected. 'public' is a reserved word. Class definitions are automatically in strict mode. -tests/cases/compiler/strictModeCode1.ts(11,24): error TS1213: Identifier expected. 'public' is a reserved word. Class definitions are automatically in strict mode. -tests/cases/compiler/strictModeCode1.ts(11,32): error TS1213: Identifier expected. 'let' is a reserved word. Class definitions are automatically in strict mode. -tests/cases/compiler/strictModeCode1.ts(13,10): error TS1213: Identifier expected. 'private' is a reserved word. Class definitions are automatically in strict mode. -tests/cases/compiler/strictModeCode1.ts(13,19): error TS1213: Identifier expected. 'static' is a reserved word. Class definitions are automatically in strict mode. -tests/cases/compiler/strictModeCode1.ts(13,27): error TS1213: Identifier expected. 'public' is a reserved word. Class definitions are automatically in strict mode. -tests/cases/compiler/strictModeCode1.ts(14,18): error TS1213: Identifier expected. 'let' is a reserved word. Class definitions are automatically in strict mode. -tests/cases/compiler/strictModeCode1.ts(20,9): error TS1213: Identifier expected. 'public' is a reserved word. Class definitions are automatically in strict mode. -tests/cases/compiler/strictModeCode1.ts(20,17): error TS1213: Identifier expected. 'private' is a reserved word. Class definitions are automatically in strict mode. +tests/cases/compiler/strictModeCode1.ts(7,22): error TS1216: Type expected. 'public' is a reserved word in strict mode. Class definitions are automatically in strict mode. +tests/cases/compiler/strictModeCode1.ts(11,24): error TS1213: Identifier expected. 'public' is a reserved word in strict mode. Class definitions are automatically in strict mode. +tests/cases/compiler/strictModeCode1.ts(11,32): error TS1213: Identifier expected. 'let' is a reserved word in strict mode. Class definitions are automatically in strict mode. +tests/cases/compiler/strictModeCode1.ts(13,10): error TS1213: Identifier expected. 'private' is a reserved word in strict mode. Class definitions are automatically in strict mode. +tests/cases/compiler/strictModeCode1.ts(13,19): error TS1213: Identifier expected. 'static' is a reserved word in strict mode. Class definitions are automatically in strict mode. +tests/cases/compiler/strictModeCode1.ts(13,27): error TS1213: Identifier expected. 'public' is a reserved word in strict mode. Class definitions are automatically in strict mode. +tests/cases/compiler/strictModeCode1.ts(14,18): error TS1213: Identifier expected. 'let' is a reserved word in strict mode. Class definitions are automatically in strict mode. +tests/cases/compiler/strictModeCode1.ts(20,9): error TS1213: Identifier expected. 'public' is a reserved word in strict mode. Class definitions are automatically in strict mode. +tests/cases/compiler/strictModeCode1.ts(20,17): error TS1213: Identifier expected. 'private' is a reserved word in strict mode. Class definitions are automatically in strict mode. tests/cases/compiler/strictModeCode1.ts(22,20): error TS1212: Identifier expected. 'public' is a reserved word in strict mode @@ -22,11 +22,11 @@ tests/cases/compiler/strictModeCode1.ts(22,20): error TS1212: Identifier expecte class Foo { constructor(private, public, static) { ~~~~~~~ -!!! error TS1213: Identifier expected. 'private' is a reserved word. Class definitions are automatically in strict mode. +!!! error TS1213: Identifier expected. 'private' is a reserved word in strict mode. Class definitions are automatically in strict mode. ~~~~~~ -!!! error TS1213: Identifier expected. 'public' is a reserved word. Class definitions are automatically in strict mode. +!!! error TS1213: Identifier expected. 'public' is a reserved word in strict mode. Class definitions are automatically in strict mode. ~~~~~~ -!!! error TS1213: Identifier expected. 'static' is a reserved word. Class definitions are automatically in strict mode. +!!! error TS1213: Identifier expected. 'static' is a reserved word in strict mode. Class definitions are automatically in strict mode. private = public = static; ~~~~~~~ !!! error TS1212: Identifier expected. 'private' is a reserved word in strict mode @@ -37,26 +37,26 @@ tests/cases/compiler/strictModeCode1.ts(22,20): error TS1212: Identifier expecte } public banana(x: public) { } ~~~~~~ -!!! error TS1216: Type expected. 'public' is a reserved word. Class definitions are automatically in strict mode. +!!! error TS1216: Type expected. 'public' is a reserved word in strict mode. Class definitions are automatically in strict mode. } class C { constructor(public public, let) { ~~~~~~ -!!! error TS1213: Identifier expected. 'public' is a reserved word. Class definitions are automatically in strict mode. +!!! error TS1213: Identifier expected. 'public' is a reserved word in strict mode. Class definitions are automatically in strict mode. ~~~ -!!! error TS1213: Identifier expected. 'let' is a reserved word. Class definitions are automatically in strict mode. +!!! error TS1213: Identifier expected. 'let' is a reserved word in strict mode. Class definitions are automatically in strict mode. } foo1(private, static, public) { ~~~~~~~ -!!! error TS1213: Identifier expected. 'private' is a reserved word. Class definitions are automatically in strict mode. +!!! error TS1213: Identifier expected. 'private' is a reserved word in strict mode. Class definitions are automatically in strict mode. ~~~~~~ -!!! error TS1213: Identifier expected. 'static' is a reserved word. Class definitions are automatically in strict mode. +!!! error TS1213: Identifier expected. 'static' is a reserved word in strict mode. Class definitions are automatically in strict mode. ~~~~~~ -!!! error TS1213: Identifier expected. 'public' is a reserved word. Class definitions are automatically in strict mode. +!!! error TS1213: Identifier expected. 'public' is a reserved word in strict mode. Class definitions are automatically in strict mode. function let() { } ~~~ -!!! error TS1213: Identifier expected. 'let' is a reserved word. Class definitions are automatically in strict mode. +!!! error TS1213: Identifier expected. 'let' is a reserved word in strict mode. Class definitions are automatically in strict mode. var z = function let() { }; } @@ -64,9 +64,9 @@ tests/cases/compiler/strictModeCode1.ts(22,20): error TS1212: Identifier expecte class D{ } ~~~~~~ -!!! error TS1213: Identifier expected. 'public' is a reserved word. Class definitions are automatically in strict mode. +!!! error TS1213: Identifier expected. 'public' is a reserved word in strict mode. Class definitions are automatically in strict mode. ~~~~~~~ -!!! error TS1213: Identifier expected. 'private' is a reserved word. Class definitions are automatically in strict mode. +!!! error TS1213: Identifier expected. 'private' is a reserved word in strict mode. Class definitions are automatically in strict mode. class E implements public { } ~~~~~~ diff --git a/tests/baselines/reference/strictModeCode5.errors.txt b/tests/baselines/reference/strictModeCode5.errors.txt index f4ad705cd27..ac6d17e1bb9 100644 --- a/tests/baselines/reference/strictModeCode5.errors.txt +++ b/tests/baselines/reference/strictModeCode5.errors.txt @@ -3,9 +3,11 @@ tests/cases/compiler/strictModeCode5.ts(3,10): error TS1212: Identifier expected tests/cases/compiler/strictModeCode5.ts(4,7): error TS1212: Identifier expected. 'private' is a reserved word in strict mode tests/cases/compiler/strictModeCode5.ts(5,15): error TS1212: Identifier expected. 'static' is a reserved word in strict mode tests/cases/compiler/strictModeCode5.ts(5,38): error TS1212: Identifier expected. 'package' is a reserved word in strict mode +tests/cases/compiler/strictModeCode5.ts(6,6): error TS1212: Identifier expected. 'public' is a reserved word in strict mode +tests/cases/compiler/strictModeCode5.ts(6,14): error TS1212: Identifier expected. 'protected' is a reserved word in strict mode -==== tests/cases/compiler/strictModeCode5.ts (5 errors) ==== +==== tests/cases/compiler/strictModeCode5.ts (7 errors) ==== "use strict" var [public] = [1]; ~~~~~~ @@ -20,4 +22,9 @@ tests/cases/compiler/strictModeCode5.ts(5,38): error TS1212: Identifier expected ~~~~~~ !!! error TS1212: Identifier expected. 'static' is a reserved word in strict mode ~~~~~~~ -!!! error TS1212: Identifier expected. 'package' is a reserved word in strict mode \ No newline at end of file +!!! error TS1212: Identifier expected. 'package' is a reserved word in strict mode + var {public, protected} = { public: 1, protected: 2 }; + ~~~~~~ +!!! error TS1212: Identifier expected. 'public' is a reserved word in strict mode + ~~~~~~~~~ +!!! error TS1212: Identifier expected. 'protected' is a reserved word in strict mode \ No newline at end of file diff --git a/tests/baselines/reference/strictModeCode5.js b/tests/baselines/reference/strictModeCode5.js index 746d2dab580..8a480b0fe70 100644 --- a/tests/baselines/reference/strictModeCode5.js +++ b/tests/baselines/reference/strictModeCode5.js @@ -3,7 +3,8 @@ var [public] = [1]; var { x: public } = { x: 1 }; var [[private]] = [["hello"]]; -var { y: { s: static }, z: { o: { p: package} }} = { y: { s: 1 }, z: { o: { p: 'h' } } }; +var { y: { s: static }, z: { o: { p: package} }} = { y: { s: 1 }, z: { o: { p: 'h' } } }; +var {public, protected} = { public: 1, protected: 2 }; //// [strictModeCode5.js] "use strict"; @@ -11,3 +12,4 @@ var public = ([1])[0]; var public = ({ x: 1 }).x; var private = ([["hello"]])[0][0]; var _a = { y: { s: 1 }, z: { o: { p: 'h' } } }, static = _a.y.s, package = _a.z.o.p; +var _b = { public: 1, protected: 2 }, public = _b.public, protected = _b.protected; diff --git a/tests/baselines/reference/strictModeCode8.errors.txt b/tests/baselines/reference/strictModeCode8.errors.txt index b0134007e0d..25b087e9016 100644 --- a/tests/baselines/reference/strictModeCode8.errors.txt +++ b/tests/baselines/reference/strictModeCode8.errors.txt @@ -1,12 +1,24 @@ -tests/cases/compiler/strictModeCode8.ts(2,8): error TS1214: Identifier expected. 'public' is a reserved word. Module is automatically in strict mode. -tests/cases/compiler/strictModeCode8.ts(3,8): error TS1214: Identifier expected. 'private' is a reserved word. Module is automatically in strict mode. +tests/cases/compiler/strictModeCode8.ts(2,8): error TS1212: Identifier expected. 'public' is a reserved word in strict mode +tests/cases/compiler/strictModeCode8.ts(3,8): error TS1212: Identifier expected. 'private' is a reserved word in strict mode +tests/cases/compiler/strictModeCode8.ts(4,8): error TS1212: Identifier expected. 'public' is a reserved word in strict mode +tests/cases/compiler/strictModeCode8.ts(6,8): error TS1212: Identifier expected. 'private' is a reserved word in strict mode +tests/cases/compiler/strictModeCode8.ts(6,16): error TS1212: Identifier expected. 'public' is a reserved word in strict mode -==== tests/cases/compiler/strictModeCode8.ts (2 errors) ==== +==== tests/cases/compiler/strictModeCode8.ts (5 errors) ==== "use strict" module public { } ~~~~~~ -!!! error TS1214: Identifier expected. 'public' is a reserved word. Module is automatically in strict mode. +!!! error TS1212: Identifier expected. 'public' is a reserved word in strict mode module private { } ~~~~~~~ -!!! error TS1214: Identifier expected. 'private' is a reserved word. Module is automatically in strict mode. \ No newline at end of file +!!! error TS1212: Identifier expected. 'private' is a reserved word in strict mode + module public.whatever { + ~~~~~~ +!!! error TS1212: Identifier expected. 'public' is a reserved word in strict mode + } + module private.public.foo { } + ~~~~~~~ +!!! error TS1212: Identifier expected. 'private' is a reserved word in strict mode + ~~~~~~ +!!! error TS1212: Identifier expected. 'public' is a reserved word in strict mode \ No newline at end of file diff --git a/tests/baselines/reference/strictModeCode8.js b/tests/baselines/reference/strictModeCode8.js index 39d7cfff9ca..e2c541217f4 100644 --- a/tests/baselines/reference/strictModeCode8.js +++ b/tests/baselines/reference/strictModeCode8.js @@ -1,7 +1,10 @@ //// [strictModeCode8.ts] "use strict" module public { } -module private { } +module private { } +module public.whatever { +} +module private.public.foo { } //// [strictModeCode8.js] "use strict"; diff --git a/tests/cases/compiler/strictModeCode5.ts b/tests/cases/compiler/strictModeCode5.ts index 4f4ff9f564f..8f25ab1e6d5 100644 --- a/tests/cases/compiler/strictModeCode5.ts +++ b/tests/cases/compiler/strictModeCode5.ts @@ -2,4 +2,5 @@ var [public] = [1]; var { x: public } = { x: 1 }; var [[private]] = [["hello"]]; -var { y: { s: static }, z: { o: { p: package} }} = { y: { s: 1 }, z: { o: { p: 'h' } } }; \ No newline at end of file +var { y: { s: static }, z: { o: { p: package} }} = { y: { s: 1 }, z: { o: { p: 'h' } } }; +var {public, protected} = { public: 1, protected: 2 }; \ No newline at end of file diff --git a/tests/cases/compiler/strictModeCode8.ts b/tests/cases/compiler/strictModeCode8.ts index 88a409ebb7b..24c4b7d6177 100644 --- a/tests/cases/compiler/strictModeCode8.ts +++ b/tests/cases/compiler/strictModeCode8.ts @@ -1,3 +1,6 @@ "use strict" module public { } -module private { } \ No newline at end of file +module private { } +module public.whatever { +} +module private.public.foo { } \ No newline at end of file