diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 56948b2288ca0..8fe87324a0afe 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -1655,14 +1655,25 @@ namespace ts { if (declaration === undefined) return Debug.fail("Declaration to checkResolvedBlockScopedVariable is undefined"); if (!(declaration.flags & NodeFlags.Ambient) && !isBlockScopedNameDeclaredBeforeUse(declaration, errorLocation)) { + let diagnosticMessage; + const declarationName = declarationNameToString(getNameOfDeclaration(declaration)); if (result.flags & SymbolFlags.BlockScopedVariable) { - error(errorLocation, Diagnostics.Block_scoped_variable_0_used_before_its_declaration, declarationNameToString(getNameOfDeclaration(declaration))); + diagnosticMessage = error(errorLocation, Diagnostics.Block_scoped_variable_0_used_before_its_declaration, declarationName); } else if (result.flags & SymbolFlags.Class) { - error(errorLocation, Diagnostics.Class_0_used_before_its_declaration, declarationNameToString(getNameOfDeclaration(declaration))); + diagnosticMessage = error(errorLocation, Diagnostics.Class_0_used_before_its_declaration, declarationName); } else if (result.flags & SymbolFlags.RegularEnum) { - error(errorLocation, Diagnostics.Enum_0_used_before_its_declaration, declarationNameToString(getNameOfDeclaration(declaration))); + diagnosticMessage = error(errorLocation, Diagnostics.Enum_0_used_before_its_declaration, declarationName); + } + else { + Debug.assert(!!(result.flags & SymbolFlags.ConstEnum)); + } + + if (diagnosticMessage) { + addRelatedInfo(diagnosticMessage, + createDiagnosticForNode(declaration, Diagnostics._0_was_declared_here, declarationName) + ); } } } @@ -17460,16 +17471,24 @@ namespace ts { return; } + let diagnosticMessage; + const declarationName = idText(right); if (isInPropertyInitializer(node) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right) && !isPropertyDeclaredInAncestorClass(prop)) { - error(right, Diagnostics.Block_scoped_variable_0_used_before_its_declaration, idText(right)); + diagnosticMessage = error(right, Diagnostics.Block_scoped_variable_0_used_before_its_declaration, declarationName); } else if (valueDeclaration.kind === SyntaxKind.ClassDeclaration && node.parent.kind !== SyntaxKind.TypeReference && !(valueDeclaration.flags & NodeFlags.Ambient) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right)) { - error(right, Diagnostics.Class_0_used_before_its_declaration, idText(right)); + diagnosticMessage = error(right, Diagnostics.Class_0_used_before_its_declaration, declarationName); + } + + if (diagnosticMessage) { + addRelatedInfo(diagnosticMessage, + createDiagnosticForNode(valueDeclaration, Diagnostics._0_was_declared_here, declarationName) + ); } } @@ -19083,8 +19102,8 @@ namespace ts { if (importNode && !isImportCall(importNode)) { const sigs = getSignaturesOfType(getTypeOfSymbol(getSymbolLinks(apparentType.symbol).target!), kind); if (!sigs || !sigs.length) return; - diagnostic.relatedInformation = diagnostic.relatedInformation || []; - diagnostic.relatedInformation.push(createDiagnosticForNode(importNode, Diagnostics.Type_originates_at_this_import_A_namespace_style_import_cannot_be_called_or_constructed_and_will_cause_a_failure_at_runtime_Consider_using_a_default_import_or_import_require_here_instead)); + Debug.assert(!diagnostic.relatedInformation); + diagnostic.relatedInformation = [createDiagnosticForNode(importNode, Diagnostics.Type_originates_at_this_import_A_namespace_style_import_cannot_be_called_or_constructed_and_will_cause_a_failure_at_runtime_Consider_using_a_default_import_or_import_require_here_instead)]; } } diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index e70339ae1271f..eea818b5f9fab 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -2397,6 +2397,10 @@ "category": "Error", "code": 2727 }, + "'{0}' was declared here.": { + "category": "Error", + "code": 2728 + }, "Import declaration '{0}' is using private name '{1}'.": { "category": "Error", diff --git a/tests/baselines/reference/ES5For-of17.errors.txt b/tests/baselines/reference/ES5For-of17.errors.txt index 3b9ab93a565b7..bddcd678ac2f6 100644 --- a/tests/baselines/reference/ES5For-of17.errors.txt +++ b/tests/baselines/reference/ES5For-of17.errors.txt @@ -7,6 +7,7 @@ tests/cases/conformance/statements/for-ofStatements/ES5For-of17.ts(3,20): error for (let v of [v]) { ~ !!! error TS2448: Block-scoped variable 'v' used before its declaration. +!!! related TS2728 tests/cases/conformance/statements/for-ofStatements/ES5For-of17.ts:3:14: 'v' was declared here. var x = v; v++; } diff --git a/tests/baselines/reference/ES5For-of20.errors.txt b/tests/baselines/reference/ES5For-of20.errors.txt index d58aa6c781f3d..bc2e4ee0f2b7f 100644 --- a/tests/baselines/reference/ES5For-of20.errors.txt +++ b/tests/baselines/reference/ES5For-of20.errors.txt @@ -8,6 +8,7 @@ tests/cases/conformance/statements/for-ofStatements/ES5For-of20.ts(4,15): error for (let v of [v]) { ~ !!! error TS2448: Block-scoped variable 'v' used before its declaration. +!!! related TS2728 tests/cases/conformance/statements/for-ofStatements/ES5For-of20.ts:3:14: 'v' was declared here. const v; ~ !!! error TS1155: 'const' declarations must be initialized. diff --git a/tests/baselines/reference/ModuleAndClassWithSameNameAndCommonRoot.errors.txt b/tests/baselines/reference/ModuleAndClassWithSameNameAndCommonRoot.errors.txt index 0da61368eee3b..e89e993b6bd64 100644 --- a/tests/baselines/reference/ModuleAndClassWithSameNameAndCommonRoot.errors.txt +++ b/tests/baselines/reference/ModuleAndClassWithSameNameAndCommonRoot.errors.txt @@ -32,6 +32,7 @@ tests/cases/conformance/internalModules/DeclarationMerging/simple.ts(2,31): erro export var Instance = new A(); ~ !!! error TS2449: Class 'A' used before its declaration. +!!! related TS2728 tests/cases/conformance/internalModules/DeclarationMerging/simple.ts:6:7: 'A' was declared here. } // duplicate identifier diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index c4dd269688045..f3b7e4047cc48 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -5418,6 +5418,7 @@ declare namespace ts { Class_name_cannot_be_Object_when_targeting_ES5_with_module_0: DiagnosticMessage; Cannot_find_lib_definition_for_0: DiagnosticMessage; Cannot_find_lib_definition_for_0_Did_you_mean_1: DiagnosticMessage; + _0_was_declared_here: DiagnosticMessage; Import_declaration_0_is_using_private_name_1: DiagnosticMessage; Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: DiagnosticMessage; Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: DiagnosticMessage; diff --git a/tests/baselines/reference/blockScopedBindingUsedBeforeDef.errors.txt b/tests/baselines/reference/blockScopedBindingUsedBeforeDef.errors.txt index 3a55ebbfded50..3179710b21b86 100644 --- a/tests/baselines/reference/blockScopedBindingUsedBeforeDef.errors.txt +++ b/tests/baselines/reference/blockScopedBindingUsedBeforeDef.errors.txt @@ -8,13 +8,16 @@ tests/cases/compiler/blockScopedBindingUsedBeforeDef.ts(8,7): error TS2448: Bloc for (let {[a]: a} of [{ }]) continue; ~ !!! error TS2448: Block-scoped variable 'a' used before its declaration. +!!! related TS2728 tests/cases/compiler/blockScopedBindingUsedBeforeDef.ts:2:16: 'a' was declared here. // 2: for (let {[a]: a} = { }; false; ) continue; ~ !!! error TS2448: Block-scoped variable 'a' used before its declaration. +!!! related TS2728 tests/cases/compiler/blockScopedBindingUsedBeforeDef.ts:5:16: 'a' was declared here. // 3: let {[b]: b} = { }; ~ -!!! error TS2448: Block-scoped variable 'b' used before its declaration. \ No newline at end of file +!!! error TS2448: Block-scoped variable 'b' used before its declaration. +!!! related TS2728 tests/cases/compiler/blockScopedBindingUsedBeforeDef.ts:8:11: 'b' was declared here. \ No newline at end of file diff --git a/tests/baselines/reference/blockScopedVariablesUseBeforeDef.errors.txt b/tests/baselines/reference/blockScopedVariablesUseBeforeDef.errors.txt index 94c58bccb041c..cc526c2c2f2a5 100644 --- a/tests/baselines/reference/blockScopedVariablesUseBeforeDef.errors.txt +++ b/tests/baselines/reference/blockScopedVariablesUseBeforeDef.errors.txt @@ -9,6 +9,7 @@ tests/cases/compiler/blockScopedVariablesUseBeforeDef.ts(100,12): error TS2448: let a = x; ~ !!! error TS2448: Block-scoped variable 'x' used before its declaration. +!!! related TS2728 tests/cases/compiler/blockScopedVariablesUseBeforeDef.ts:3:9: 'x' was declared here. let x; } @@ -67,6 +68,7 @@ tests/cases/compiler/blockScopedVariablesUseBeforeDef.ts(100,12): error TS2448: static a = x; ~ !!! error TS2448: Block-scoped variable 'x' used before its declaration. +!!! related TS2728 tests/cases/compiler/blockScopedVariablesUseBeforeDef.ts:60:9: 'x' was declared here. } let x; } @@ -76,6 +78,7 @@ tests/cases/compiler/blockScopedVariablesUseBeforeDef.ts(100,12): error TS2448: static a = x; ~ !!! error TS2448: Block-scoped variable 'x' used before its declaration. +!!! related TS2728 tests/cases/compiler/blockScopedVariablesUseBeforeDef.ts:67:9: 'x' was declared here. } let x; } @@ -113,6 +116,7 @@ tests/cases/compiler/blockScopedVariablesUseBeforeDef.ts(100,12): error TS2448: a: x ~ !!! error TS2448: Block-scoped variable 'x' used before its declaration. +!!! related TS2728 tests/cases/compiler/blockScopedVariablesUseBeforeDef.ts:102:9: 'x' was declared here. } let x } \ No newline at end of file diff --git a/tests/baselines/reference/circularImportAlias.errors.txt b/tests/baselines/reference/circularImportAlias.errors.txt index 13ff1d8c7c92f..5ebf9405e56e4 100644 --- a/tests/baselines/reference/circularImportAlias.errors.txt +++ b/tests/baselines/reference/circularImportAlias.errors.txt @@ -9,6 +9,7 @@ tests/cases/conformance/internalModules/importDeclarations/circularImportAlias.t export class D extends a.C { ~ !!! error TS2449: Class 'C' used before its declaration. +!!! related TS2728 tests/cases/conformance/internalModules/importDeclarations/circularImportAlias.ts:11:18: 'C' was declared here. id: number; } } diff --git a/tests/baselines/reference/classAbstractInstantiations2.errors.txt b/tests/baselines/reference/classAbstractInstantiations2.errors.txt index d05e05517b265..5349382940ea4 100644 --- a/tests/baselines/reference/classAbstractInstantiations2.errors.txt +++ b/tests/baselines/reference/classAbstractInstantiations2.errors.txt @@ -45,6 +45,7 @@ tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbst var x : any = C; ~ !!! error TS2449: Class 'C' used before its declaration. +!!! related TS2728 tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts:26:7: 'C' was declared here. new x; // okay -- undefined behavior at runtime class C extends B { } // error -- not declared abstract diff --git a/tests/baselines/reference/classDeclarationShouldBeOutOfScopeInComputedNames.errors.txt b/tests/baselines/reference/classDeclarationShouldBeOutOfScopeInComputedNames.errors.txt index f7b8244f01327..3c3f0ad3fb314 100644 --- a/tests/baselines/reference/classDeclarationShouldBeOutOfScopeInComputedNames.errors.txt +++ b/tests/baselines/reference/classDeclarationShouldBeOutOfScopeInComputedNames.errors.txt @@ -12,14 +12,18 @@ tests/cases/compiler/classDeclarationShouldBeOutOfScopeInComputedNames.ts(8,6): static readonly [A.p1] = 0; ~ !!! error TS2449: Class 'A' used before its declaration. +!!! related TS2728 tests/cases/compiler/classDeclarationShouldBeOutOfScopeInComputedNames.ts:1:7: 'A' was declared here. static [A.p2]() { return 0 }; ~ !!! error TS2449: Class 'A' used before its declaration. +!!! related TS2728 tests/cases/compiler/classDeclarationShouldBeOutOfScopeInComputedNames.ts:1:7: 'A' was declared here. [A.p1]() { } ~ !!! error TS2449: Class 'A' used before its declaration. +!!! related TS2728 tests/cases/compiler/classDeclarationShouldBeOutOfScopeInComputedNames.ts:1:7: 'A' was declared here. [A.p2] = 0 ~ !!! error TS2449: Class 'A' used before its declaration. +!!! related TS2728 tests/cases/compiler/classDeclarationShouldBeOutOfScopeInComputedNames.ts:1:7: 'A' was declared here. } \ No newline at end of file diff --git a/tests/baselines/reference/classExtendsItselfIndirectly.errors.txt b/tests/baselines/reference/classExtendsItselfIndirectly.errors.txt index 8f54ef1805161..908b8feffc3be 100644 --- a/tests/baselines/reference/classExtendsItselfIndirectly.errors.txt +++ b/tests/baselines/reference/classExtendsItselfIndirectly.errors.txt @@ -14,6 +14,7 @@ tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/cla !!! error TS2506: 'C' is referenced directly or indirectly in its own base expression. ~ !!! error TS2449: Class 'E' used before its declaration. +!!! related TS2728 tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly.ts:5:7: 'E' was declared here. class D extends C { bar: string; } ~ @@ -28,6 +29,7 @@ tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/cla !!! error TS2506: 'C2' is referenced directly or indirectly in its own base expression. ~~ !!! error TS2449: Class 'E2' used before its declaration. +!!! related TS2728 tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly.ts:11:7: 'E2' was declared here. class D2 extends C2 { bar: T; } ~~ diff --git a/tests/baselines/reference/classExtendsItselfIndirectly2.errors.txt b/tests/baselines/reference/classExtendsItselfIndirectly2.errors.txt index 48c787b54d9ab..8fabd5364b74f 100644 --- a/tests/baselines/reference/classExtendsItselfIndirectly2.errors.txt +++ b/tests/baselines/reference/classExtendsItselfIndirectly2.errors.txt @@ -14,6 +14,7 @@ tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/cla !!! error TS2506: 'C' is referenced directly or indirectly in its own base expression. ~ !!! error TS2449: Class 'E' used before its declaration. +!!! related TS2728 tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly2.ts:9:18: 'E' was declared here. module M { export class D extends C { bar: string; } @@ -34,6 +35,7 @@ tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/cla !!! error TS2506: 'C2' is referenced directly or indirectly in its own base expression. ~~ !!! error TS2449: Class 'E2' used before its declaration. +!!! related TS2728 tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsItselfIndirectly2.ts:20:22: 'E2' was declared here. module P { export class D2 extends C2 { bar: T; } diff --git a/tests/baselines/reference/classInheritence.errors.txt b/tests/baselines/reference/classInheritence.errors.txt index 3bad3caf3d22f..b5231b768a930 100644 --- a/tests/baselines/reference/classInheritence.errors.txt +++ b/tests/baselines/reference/classInheritence.errors.txt @@ -6,6 +6,7 @@ tests/cases/compiler/classInheritence.ts(2,7): error TS2506: 'A' is referenced d class B extends A { } ~ !!! error TS2449: Class 'A' used before its declaration. +!!! related TS2728 tests/cases/compiler/classInheritence.ts:2:7: 'A' was declared here. class A extends A { } ~ !!! error TS2506: 'A' is referenced directly or indirectly in its own base expression. \ No newline at end of file diff --git a/tests/baselines/reference/classMergedWithInterfaceMultipleBasesNoError.errors.txt b/tests/baselines/reference/classMergedWithInterfaceMultipleBasesNoError.errors.txt index f760cf9bf2ae7..aa21114b4bcd8 100644 --- a/tests/baselines/reference/classMergedWithInterfaceMultipleBasesNoError.errors.txt +++ b/tests/baselines/reference/classMergedWithInterfaceMultipleBasesNoError.errors.txt @@ -12,5 +12,6 @@ tests/cases/compiler/classMergedWithInterfaceMultipleBasesNoError.ts(8,30): erro readonly observer = this.handleIntersection; ~~~~~~~~~~~~~~~~~~ !!! error TS2448: Block-scoped variable 'handleIntersection' used before its declaration. +!!! related TS2728 tests/cases/compiler/classMergedWithInterfaceMultipleBasesNoError.ts:9:14: 'handleIntersection' was declared here. readonly handleIntersection = () => { } } \ No newline at end of file diff --git a/tests/baselines/reference/classOrder2.errors.txt b/tests/baselines/reference/classOrder2.errors.txt index ce6dd9bd50f0c..09b8fb47c18f4 100644 --- a/tests/baselines/reference/classOrder2.errors.txt +++ b/tests/baselines/reference/classOrder2.errors.txt @@ -5,6 +5,7 @@ tests/cases/compiler/classOrder2.ts(1,17): error TS2449: Class 'B' used before i class A extends B { ~ !!! error TS2449: Class 'B' used before its declaration. +!!! related TS2728 tests/cases/compiler/classOrder2.ts:7:7: 'B' was declared here. foo() { this.bar(); } diff --git a/tests/baselines/reference/classSideInheritance2.errors.txt b/tests/baselines/reference/classSideInheritance2.errors.txt index 7b27ee7c0f903..88ad429e2eccd 100644 --- a/tests/baselines/reference/classSideInheritance2.errors.txt +++ b/tests/baselines/reference/classSideInheritance2.errors.txt @@ -11,6 +11,7 @@ tests/cases/compiler/classSideInheritance2.ts(7,23): error TS2449: Class 'TextBa class SubText extends TextBase { ~~~~~~~~ !!! error TS2449: Class 'TextBase' used before its declaration. +!!! related TS2728 tests/cases/compiler/classSideInheritance2.ts:14:7: 'TextBase' was declared here. constructor(text: IText, span: TextSpan) { super(); diff --git a/tests/baselines/reference/classStaticInitializersUsePropertiesBeforeDeclaration.errors.txt b/tests/baselines/reference/classStaticInitializersUsePropertiesBeforeDeclaration.errors.txt index 8b53637b884ee..abfb42419b725 100644 --- a/tests/baselines/reference/classStaticInitializersUsePropertiesBeforeDeclaration.errors.txt +++ b/tests/baselines/reference/classStaticInitializersUsePropertiesBeforeDeclaration.errors.txt @@ -10,16 +10,21 @@ tests/cases/compiler/classStaticInitializersUsePropertiesBeforeDeclaration.ts(4, static enumMember = Enum.A; ~~~~ !!! error TS2450: Enum 'Enum' used before its declaration. +!!! related TS2728 tests/cases/compiler/classStaticInitializersUsePropertiesBeforeDeclaration.ts:7:6: 'Enum' was declared here. ~ !!! error TS2448: Block-scoped variable 'A' used before its declaration. +!!! related TS2728 tests/cases/compiler/classStaticInitializersUsePropertiesBeforeDeclaration.ts:8:5: 'A' was declared here. static objLiteralMember = ObjLiteral.A; ~~~~~~~~~~ !!! error TS2448: Block-scoped variable 'ObjLiteral' used before its declaration. +!!! related TS2728 tests/cases/compiler/classStaticInitializersUsePropertiesBeforeDeclaration.ts:11:7: 'ObjLiteral' was declared here. ~ !!! error TS2448: Block-scoped variable 'A' used before its declaration. +!!! related TS2728 tests/cases/compiler/classStaticInitializersUsePropertiesBeforeDeclaration.ts:12:5: 'A' was declared here. static namespaceMember = Namespace.A; ~ !!! error TS2448: Block-scoped variable 'A' used before its declaration. +!!! related TS2728 tests/cases/compiler/classStaticInitializersUsePropertiesBeforeDeclaration.ts:16:16: 'A' was declared here. } enum Enum { diff --git a/tests/baselines/reference/complexClassRelationships.errors.txt b/tests/baselines/reference/complexClassRelationships.errors.txt index c978a36c036ee..90a6ae0a8beca 100644 --- a/tests/baselines/reference/complexClassRelationships.errors.txt +++ b/tests/baselines/reference/complexClassRelationships.errors.txt @@ -6,6 +6,7 @@ tests/cases/compiler/complexClassRelationships.ts(2,23): error TS2449: Class 'Ba class Derived extends Base { ~~~~ !!! error TS2449: Class 'Base' used before its declaration. +!!! related TS2728 tests/cases/compiler/complexClassRelationships.ts:13:7: 'Base' was declared here. public static createEmpty(): Derived { var item = new Derived(); return item; diff --git a/tests/baselines/reference/computedPropertyNamesWithStaticProperty.errors.txt b/tests/baselines/reference/computedPropertyNamesWithStaticProperty.errors.txt index 5ce2c8bfe1ce5..93edb2d90c04c 100644 --- a/tests/baselines/reference/computedPropertyNamesWithStaticProperty.errors.txt +++ b/tests/baselines/reference/computedPropertyNamesWithStaticProperty.errors.txt @@ -9,14 +9,17 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNamesWithStaticPr get [C.staticProp]() { ~ !!! error TS2449: Class 'C' used before its declaration. +!!! related TS2728 tests/cases/conformance/es6/computedProperties/computedPropertyNamesWithStaticProperty.ts:1:7: 'C' was declared here. return "hello"; } set [C.staticProp](x: string) { ~ !!! error TS2449: Class 'C' used before its declaration. +!!! related TS2728 tests/cases/conformance/es6/computedProperties/computedPropertyNamesWithStaticProperty.ts:1:7: 'C' was declared here. var y = x; } [C.staticProp]() { } ~ !!! error TS2449: Class 'C' used before its declaration. +!!! related TS2728 tests/cases/conformance/es6/computedProperties/computedPropertyNamesWithStaticProperty.ts:1:7: 'C' was declared here. } \ No newline at end of file diff --git a/tests/baselines/reference/constDeclarations-useBeforeDefinition.errors.txt b/tests/baselines/reference/constDeclarations-useBeforeDefinition.errors.txt index a4d33065b5946..670ef38c91dac 100644 --- a/tests/baselines/reference/constDeclarations-useBeforeDefinition.errors.txt +++ b/tests/baselines/reference/constDeclarations-useBeforeDefinition.errors.txt @@ -7,6 +7,7 @@ tests/cases/compiler/constDeclarations-useBeforeDefinition.ts(8,5): error TS2448 c1; ~~ !!! error TS2448: Block-scoped variable 'c1' used before its declaration. +!!! related TS2728 tests/cases/compiler/constDeclarations-useBeforeDefinition.ts:3:11: 'c1' was declared here. const c1 = 0; } @@ -15,6 +16,7 @@ tests/cases/compiler/constDeclarations-useBeforeDefinition.ts(8,5): error TS2448 v1; ~~ !!! error TS2448: Block-scoped variable 'v1' used before its declaration. +!!! related TS2728 tests/cases/compiler/constDeclarations-useBeforeDefinition.ts:9:11: 'v1' was declared here. const v1 = 0; } \ No newline at end of file diff --git a/tests/baselines/reference/constDeclarations-useBeforeDefinition2.errors.txt b/tests/baselines/reference/constDeclarations-useBeforeDefinition2.errors.txt index bbcc3b2c8f8be..df5f88319fd80 100644 --- a/tests/baselines/reference/constDeclarations-useBeforeDefinition2.errors.txt +++ b/tests/baselines/reference/constDeclarations-useBeforeDefinition2.errors.txt @@ -5,6 +5,7 @@ tests/cases/compiler/file1.ts(1,1): error TS2448: Block-scoped variable 'c' used c; ~ !!! error TS2448: Block-scoped variable 'c' used before its declaration. +!!! related TS2728 tests/cases/compiler/file2.ts:1:7: 'c' was declared here. ==== tests/cases/compiler/file2.ts (0 errors) ==== const c = 0; \ No newline at end of file diff --git a/tests/baselines/reference/derivedClasses.errors.txt b/tests/baselines/reference/derivedClasses.errors.txt index ff6946df2ca72..24223a374e2f0 100644 --- a/tests/baselines/reference/derivedClasses.errors.txt +++ b/tests/baselines/reference/derivedClasses.errors.txt @@ -5,6 +5,7 @@ tests/cases/compiler/derivedClasses.ts(1,19): error TS2449: Class 'Color' used b class Red extends Color { ~~~~~ !!! error TS2449: Class 'Color' used before its declaration. +!!! related TS2728 tests/cases/compiler/derivedClasses.ts:8:7: 'Color' was declared here. public shade() { var getHue = () => { return this.hue(); }; return getHue() + " red"; diff --git a/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment3.errors.txt b/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment3.errors.txt index a68affcf73de8..34fa5c1f72a98 100644 --- a/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment3.errors.txt +++ b/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment3.errors.txt @@ -9,9 +9,11 @@ tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAss const [c, d = c, e = e] = [1]; // error for e = e ~ !!! error TS2448: Block-scoped variable 'e' used before its declaration. +!!! related TS2728 tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment3.ts:2:18: 'e' was declared here. const [f, g = f, h = i, i = f] = [1]; // error for h = i ~ !!! error TS2448: Block-scoped variable 'i' used before its declaration. +!!! related TS2728 tests/cases/conformance/es6/destructuring/destructuringArrayBindingPatternAndAssignment3.ts:3:25: 'i' was declared here. (function ([a, b = a]) { // ok })([1]); diff --git a/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment4.errors.txt b/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment4.errors.txt index 6a3f0f2b4572b..db8b13c378611 100644 --- a/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment4.errors.txt +++ b/tests/baselines/reference/destructuringObjectBindingPatternAndAssignment4.errors.txt @@ -11,8 +11,10 @@ tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAs e = f, // error ~ !!! error TS2448: Block-scoped variable 'f' used before its declaration. +!!! related TS2728 tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment4.ts:7:5: 'f' was declared here. f = f // error ~ !!! error TS2448: Block-scoped variable 'f' used before its declaration. +!!! related TS2728 tests/cases/conformance/es6/destructuring/destructuringObjectBindingPatternAndAssignment4.ts:7:5: 'f' was declared here. } = { } as any; \ No newline at end of file diff --git a/tests/baselines/reference/enumUsedBeforeDeclaration.errors.txt b/tests/baselines/reference/enumUsedBeforeDeclaration.errors.txt index 64e1830b52100..0eec10329e7b1 100644 --- a/tests/baselines/reference/enumUsedBeforeDeclaration.errors.txt +++ b/tests/baselines/reference/enumUsedBeforeDeclaration.errors.txt @@ -5,6 +5,7 @@ tests/cases/compiler/enumUsedBeforeDeclaration.ts(1,18): error TS2450: Enum 'Col const v: Color = Color.Green; ~~~~~ !!! error TS2450: Enum 'Color' used before its declaration. +!!! related TS2728 tests/cases/compiler/enumUsedBeforeDeclaration.ts:3:6: 'Color' was declared here. const v2: ConstColor = ConstColor.Green; enum Color { Red, Green, Blue } const enum ConstColor { Red, Green, Blue } diff --git a/tests/baselines/reference/es5ExportDefaultClassDeclaration3.errors.txt b/tests/baselines/reference/es5ExportDefaultClassDeclaration3.errors.txt index 045f02e4f36ac..ff7872b14b17d 100644 --- a/tests/baselines/reference/es5ExportDefaultClassDeclaration3.errors.txt +++ b/tests/baselines/reference/es5ExportDefaultClassDeclaration3.errors.txt @@ -5,6 +5,7 @@ tests/cases/compiler/es5ExportDefaultClassDeclaration3.ts(1,21): error TS2449: C var before: C = new C(); ~ !!! error TS2449: Class 'C' used before its declaration. +!!! related TS2728 tests/cases/compiler/es5ExportDefaultClassDeclaration3.ts:3:22: 'C' was declared here. export default class C { method(): C { diff --git a/tests/baselines/reference/exportAssignmentImportMergeNoCrash.errors.txt b/tests/baselines/reference/exportAssignmentImportMergeNoCrash.errors.txt index 12a7586a84882..9da5aea324e8e 100644 --- a/tests/baselines/reference/exportAssignmentImportMergeNoCrash.errors.txt +++ b/tests/baselines/reference/exportAssignmentImportMergeNoCrash.errors.txt @@ -21,4 +21,5 @@ tests/cases/compiler/user.ts(3,25): error TS2448: Block-scoped variable 'Obj' us !!! error TS2395: Individual declarations in merged declaration 'Obj' must be all exported or all local. ~~~ !!! error TS2448: Block-scoped variable 'Obj' used before its declaration. +!!! related TS2728 tests/cases/compiler/user.ts:3:14: 'Obj' was declared here. \ No newline at end of file diff --git a/tests/baselines/reference/exportBinding.errors.txt b/tests/baselines/reference/exportBinding.errors.txt index 552c048faf7a3..a0942f183d4c7 100644 --- a/tests/baselines/reference/exportBinding.errors.txt +++ b/tests/baselines/reference/exportBinding.errors.txt @@ -9,6 +9,7 @@ tests/cases/conformance/es6/modules/exportVars.ts(3,16): error TS2454: Variable export default x; ~ !!! error TS2448: Block-scoped variable 'x' used before its declaration. +!!! related TS2728 tests/cases/conformance/es6/modules/exportConsts.ts:5:7: 'x' was declared here. ~ !!! error TS2454: Variable 'x' is used before being assigned. diff --git a/tests/baselines/reference/exportedBlockScopedDeclarations.errors.txt b/tests/baselines/reference/exportedBlockScopedDeclarations.errors.txt index 06d832c86e15b..3ff26a942efc8 100644 --- a/tests/baselines/reference/exportedBlockScopedDeclarations.errors.txt +++ b/tests/baselines/reference/exportedBlockScopedDeclarations.errors.txt @@ -12,33 +12,41 @@ tests/cases/compiler/exportedBlockScopedDeclarations.ts(16,21): error TS2448: Bl const foo = foo; // compile error ~~~ !!! error TS2448: Block-scoped variable 'foo' used before its declaration. +!!! related TS2728 tests/cases/compiler/exportedBlockScopedDeclarations.ts:1:7: 'foo' was declared here. export const bar = bar; // should be compile error ~~~ !!! error TS2448: Block-scoped variable 'bar' used before its declaration. +!!! related TS2728 tests/cases/compiler/exportedBlockScopedDeclarations.ts:2:14: 'bar' was declared here. function f() { const bar = bar; // compile error ~~~ !!! error TS2448: Block-scoped variable 'bar' used before its declaration. +!!! related TS2728 tests/cases/compiler/exportedBlockScopedDeclarations.ts:4:9: 'bar' was declared here. } namespace NS { export const bar = bar; // should be compile error ~~~ !!! error TS2448: Block-scoped variable 'bar' used before its declaration. +!!! related TS2728 tests/cases/compiler/exportedBlockScopedDeclarations.ts:7:16: 'bar' was declared here. } let foo1 = foo1; // compile error ~~~~ !!! error TS2448: Block-scoped variable 'foo1' used before its declaration. +!!! related TS2728 tests/cases/compiler/exportedBlockScopedDeclarations.ts:10:5: 'foo1' was declared here. export let bar1 = bar1; // should be compile error ~~~~ !!! error TS2448: Block-scoped variable 'bar1' used before its declaration. +!!! related TS2728 tests/cases/compiler/exportedBlockScopedDeclarations.ts:11:12: 'bar1' was declared here. function f1() { let bar1 = bar1; // compile error ~~~~ !!! error TS2448: Block-scoped variable 'bar1' used before its declaration. +!!! related TS2728 tests/cases/compiler/exportedBlockScopedDeclarations.ts:13:7: 'bar1' was declared here. } namespace NS1 { export let bar1 = bar1; // should be compile error ~~~~ !!! error TS2448: Block-scoped variable 'bar1' used before its declaration. +!!! related TS2728 tests/cases/compiler/exportedBlockScopedDeclarations.ts:16:14: 'bar1' was declared here. } \ No newline at end of file diff --git a/tests/baselines/reference/extendBaseClassBeforeItsDeclared.errors.txt b/tests/baselines/reference/extendBaseClassBeforeItsDeclared.errors.txt index 64e5c7d3ef34c..a045cfd7d57d8 100644 --- a/tests/baselines/reference/extendBaseClassBeforeItsDeclared.errors.txt +++ b/tests/baselines/reference/extendBaseClassBeforeItsDeclared.errors.txt @@ -5,5 +5,6 @@ tests/cases/compiler/extendBaseClassBeforeItsDeclared.ts(1,23): error TS2449: Cl class derived extends base { } ~~~~ !!! error TS2449: Class 'base' used before its declaration. +!!! related TS2728 tests/cases/compiler/extendBaseClassBeforeItsDeclared.ts:3:7: 'base' was declared here. class base { constructor (public n: number) { } } \ No newline at end of file diff --git a/tests/baselines/reference/for-of55.errors.txt b/tests/baselines/reference/for-of55.errors.txt index aa1285afbd6ce..8740816cf721a 100644 --- a/tests/baselines/reference/for-of55.errors.txt +++ b/tests/baselines/reference/for-of55.errors.txt @@ -6,5 +6,6 @@ tests/cases/conformance/es6/for-ofStatements/for-of55.ts(2,15): error TS2448: Bl for (let v of v) { ~ !!! error TS2448: Block-scoped variable 'v' used before its declaration. +!!! related TS2728 tests/cases/conformance/es6/for-ofStatements/for-of55.ts:2:10: 'v' was declared here. v; } \ No newline at end of file diff --git a/tests/baselines/reference/forwardRefInClassProperties.errors.txt b/tests/baselines/reference/forwardRefInClassProperties.errors.txt index dcf153076ed63..2ce67dd15d058 100644 --- a/tests/baselines/reference/forwardRefInClassProperties.errors.txt +++ b/tests/baselines/reference/forwardRefInClassProperties.errors.txt @@ -9,11 +9,13 @@ tests/cases/compiler/forwardRefInClassProperties.ts(11,17): error TS2448: Block- _b = this._a; // undefined, no error/warning ~~ !!! error TS2448: Block-scoped variable '_a' used before its declaration. +!!! related TS2728 tests/cases/compiler/forwardRefInClassProperties.ts:4:5: '_a' was declared here. _a = 3; static _B = Test._A; // undefined, no error/warning ~~ !!! error TS2448: Block-scoped variable '_A' used before its declaration. +!!! related TS2728 tests/cases/compiler/forwardRefInClassProperties.ts:7:12: '_A' was declared here. static _A = 3; method() @@ -21,6 +23,7 @@ tests/cases/compiler/forwardRefInClassProperties.ts(11,17): error TS2448: Block- let a = b; // Block-scoped variable 'b' used before its declaration ~ !!! error TS2448: Block-scoped variable 'b' used before its declaration. +!!! related TS2728 tests/cases/compiler/forwardRefInClassProperties.ts:12:13: 'b' was declared here. let b = 3; } } diff --git a/tests/baselines/reference/genericClassInheritsConstructorFromNonGenericClass.errors.txt b/tests/baselines/reference/genericClassInheritsConstructorFromNonGenericClass.errors.txt index d259a2d2e27be..fe52ced70f287 100644 --- a/tests/baselines/reference/genericClassInheritsConstructorFromNonGenericClass.errors.txt +++ b/tests/baselines/reference/genericClassInheritsConstructorFromNonGenericClass.errors.txt @@ -6,9 +6,11 @@ tests/cases/compiler/genericClassInheritsConstructorFromNonGenericClass.ts(2,20) class A extends B { } ~ !!! error TS2449: Class 'B' used before its declaration. +!!! related TS2728 tests/cases/compiler/genericClassInheritsConstructorFromNonGenericClass.ts:2:7: 'B' was declared here. class B extends C { } ~ !!! error TS2449: Class 'C' used before its declaration. +!!! related TS2728 tests/cases/compiler/genericClassInheritsConstructorFromNonGenericClass.ts:3:7: 'C' was declared here. class C { constructor(p: string) { } } \ No newline at end of file diff --git a/tests/baselines/reference/indirectSelfReference.errors.txt b/tests/baselines/reference/indirectSelfReference.errors.txt index 0339dd8ed08aa..5d07a19d8498c 100644 --- a/tests/baselines/reference/indirectSelfReference.errors.txt +++ b/tests/baselines/reference/indirectSelfReference.errors.txt @@ -9,6 +9,7 @@ tests/cases/compiler/indirectSelfReference.ts(2,7): error TS2506: 'b' is referen !!! error TS2506: 'a' is referenced directly or indirectly in its own base expression. ~ !!! error TS2449: Class 'b' used before its declaration. +!!! related TS2728 tests/cases/compiler/indirectSelfReference.ts:2:7: 'b' was declared here. class b extends a{ } ~ !!! error TS2506: 'b' is referenced directly or indirectly in its own base expression. \ No newline at end of file diff --git a/tests/baselines/reference/indirectSelfReferenceGeneric.errors.txt b/tests/baselines/reference/indirectSelfReferenceGeneric.errors.txt index d1cdbf1da580f..5faf3dd83ccc1 100644 --- a/tests/baselines/reference/indirectSelfReferenceGeneric.errors.txt +++ b/tests/baselines/reference/indirectSelfReferenceGeneric.errors.txt @@ -9,6 +9,7 @@ tests/cases/compiler/indirectSelfReferenceGeneric.ts(2,7): error TS2506: 'b' is !!! error TS2506: 'a' is referenced directly or indirectly in its own base expression. ~ !!! error TS2449: Class 'b' used before its declaration. +!!! related TS2728 tests/cases/compiler/indirectSelfReferenceGeneric.ts:2:7: 'b' was declared here. class b extends a { } ~ !!! error TS2506: 'b' is referenced directly or indirectly in its own base expression. \ No newline at end of file diff --git a/tests/baselines/reference/iterableArrayPattern16.errors.txt b/tests/baselines/reference/iterableArrayPattern16.errors.txt index ba5531a0a54b5..35b1be637d51e 100644 --- a/tests/baselines/reference/iterableArrayPattern16.errors.txt +++ b/tests/baselines/reference/iterableArrayPattern16.errors.txt @@ -14,6 +14,7 @@ tests/cases/conformance/es6/destructuring/iterableArrayPattern16.ts(2,12): error !!! error TS2345: Property '0' is missing in type 'FooIterator'. ~~~~~~~~~~~~~~~~~~~ !!! error TS2449: Class 'FooIteratorIterator' used before its declaration. +!!! related TS2728 tests/cases/conformance/es6/destructuring/iterableArrayPattern16.ts:18:7: 'FooIteratorIterator' was declared here. class Bar { x } class Foo extends Bar { y } class FooIterator { diff --git a/tests/baselines/reference/jsFileCompilationLetDeclarationOrder2.errors.txt b/tests/baselines/reference/jsFileCompilationLetDeclarationOrder2.errors.txt index b88c73e043918..d1a6361986d29 100644 --- a/tests/baselines/reference/jsFileCompilationLetDeclarationOrder2.errors.txt +++ b/tests/baselines/reference/jsFileCompilationLetDeclarationOrder2.errors.txt @@ -8,6 +8,7 @@ tests/cases/compiler/a.ts(2,1): error TS2448: Block-scoped variable 'a' used bef a = 10; ~ !!! error TS2448: Block-scoped variable 'a' used before its declaration. +!!! related TS2728 tests/cases/compiler/b.js:1:5: 'a' was declared here. ==== tests/cases/compiler/b.js (0 errors) ==== let a = 10; b = 30; diff --git a/tests/baselines/reference/letDeclarations-useBeforeDefinition.errors.txt b/tests/baselines/reference/letDeclarations-useBeforeDefinition.errors.txt index 69721a93b6339..7be07585a76fc 100644 --- a/tests/baselines/reference/letDeclarations-useBeforeDefinition.errors.txt +++ b/tests/baselines/reference/letDeclarations-useBeforeDefinition.errors.txt @@ -7,6 +7,7 @@ tests/cases/compiler/letDeclarations-useBeforeDefinition.ts(8,5): error TS2448: l1; ~~ !!! error TS2448: Block-scoped variable 'l1' used before its declaration. +!!! related TS2728 tests/cases/compiler/letDeclarations-useBeforeDefinition.ts:3:9: 'l1' was declared here. let l1; } @@ -15,6 +16,7 @@ tests/cases/compiler/letDeclarations-useBeforeDefinition.ts(8,5): error TS2448: v1; ~~ !!! error TS2448: Block-scoped variable 'v1' used before its declaration. +!!! related TS2728 tests/cases/compiler/letDeclarations-useBeforeDefinition.ts:9:9: 'v1' was declared here. let v1 = 0; } \ No newline at end of file diff --git a/tests/baselines/reference/letDeclarations-useBeforeDefinition2.errors.txt b/tests/baselines/reference/letDeclarations-useBeforeDefinition2.errors.txt index 8820af5cc7c04..8259305a92268 100644 --- a/tests/baselines/reference/letDeclarations-useBeforeDefinition2.errors.txt +++ b/tests/baselines/reference/letDeclarations-useBeforeDefinition2.errors.txt @@ -5,6 +5,7 @@ tests/cases/compiler/file1.ts(1,1): error TS2448: Block-scoped variable 'l' used l; ~ !!! error TS2448: Block-scoped variable 'l' used before its declaration. +!!! related TS2728 tests/cases/compiler/file2.ts:1:7: 'l' was declared here. ==== tests/cases/compiler/file2.ts (0 errors) ==== const l = 0; \ No newline at end of file diff --git a/tests/baselines/reference/parserRealSource10.errors.txt b/tests/baselines/reference/parserRealSource10.errors.txt index d53ef3c16f900..c7fb3b62f29b1 100644 --- a/tests/baselines/reference/parserRealSource10.errors.txt +++ b/tests/baselines/reference/parserRealSource10.errors.txt @@ -475,6 +475,7 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource10.ts(449,41): error export var tokenTable = new TokenInfo[]; ~~~~~~~~~ !!! error TS2449: Class 'TokenInfo' used before its declaration. +!!! related TS2728 tests/cases/conformance/parser/ecmascript5/parserRealSource10.ts:175:18: 'TokenInfo' was declared here. !!! error TS1011: An element access expression should take an argument. export var nodeTypeTable = new string[]; diff --git a/tests/baselines/reference/privacyClassExtendsClauseDeclFile.errors.txt b/tests/baselines/reference/privacyClassExtendsClauseDeclFile.errors.txt index 62b3b2d2c22d6..ac888dc2fb1df 100644 --- a/tests/baselines/reference/privacyClassExtendsClauseDeclFile.errors.txt +++ b/tests/baselines/reference/privacyClassExtendsClauseDeclFile.errors.txt @@ -24,10 +24,12 @@ tests/cases/compiler/privacyClassExtendsClauseDeclFile_externalModule.ts(21,83): class privateClassExtendingFromPrivateModuleClass extends privateModule.publicClassInPrivateModule { ~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2449: Class 'publicClassInPrivateModule' used before its declaration. +!!! related TS2728 tests/cases/compiler/privacyClassExtendsClauseDeclFile_externalModule.ts:26:18: 'publicClassInPrivateModule' was declared here. } export class publicClassExtendingFromPrivateModuleClass extends privateModule.publicClassInPrivateModule { // Should error ~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2449: Class 'publicClassInPrivateModule' used before its declaration. +!!! related TS2728 tests/cases/compiler/privacyClassExtendsClauseDeclFile_externalModule.ts:26:18: 'publicClassInPrivateModule' was declared here. } } diff --git a/tests/baselines/reference/recursiveBaseCheck3.errors.txt b/tests/baselines/reference/recursiveBaseCheck3.errors.txt index ba0ea669c55d1..12091f9c0e609 100644 --- a/tests/baselines/reference/recursiveBaseCheck3.errors.txt +++ b/tests/baselines/reference/recursiveBaseCheck3.errors.txt @@ -10,6 +10,7 @@ tests/cases/compiler/recursiveBaseCheck3.ts(4,9): error TS2339: Property 'blah' !!! error TS2506: 'A' is referenced directly or indirectly in its own base expression. ~ !!! error TS2449: Class 'C' used before its declaration. +!!! related TS2728 tests/cases/compiler/recursiveBaseCheck3.ts:2:7: 'C' was declared here. class C extends A { } ~ !!! error TS2506: 'C' is referenced directly or indirectly in its own base expression. diff --git a/tests/baselines/reference/recursiveLetConst.errors.txt b/tests/baselines/reference/recursiveLetConst.errors.txt index b02d0819a3f46..df3fc5fdeb897 100644 --- a/tests/baselines/reference/recursiveLetConst.errors.txt +++ b/tests/baselines/reference/recursiveLetConst.errors.txt @@ -15,33 +15,43 @@ tests/cases/compiler/recursiveLetConst.ts(11,11): error TS2448: Block-scoped var let x = x + 1; ~ !!! error TS2448: Block-scoped variable 'x' used before its declaration. +!!! related TS2728 tests/cases/compiler/recursiveLetConst.ts:2:5: 'x' was declared here. let [x1] = x1 + 1; ~~ !!! error TS2448: Block-scoped variable 'x1' used before its declaration. +!!! related TS2728 tests/cases/compiler/recursiveLetConst.ts:3:6: 'x1' was declared here. const y = y + 2; ~ !!! error TS2448: Block-scoped variable 'y' used before its declaration. +!!! related TS2728 tests/cases/compiler/recursiveLetConst.ts:4:7: 'y' was declared here. const [y1] = y1 + 1; ~~ !!! error TS2448: Block-scoped variable 'y1' used before its declaration. +!!! related TS2728 tests/cases/compiler/recursiveLetConst.ts:5:8: 'y1' was declared here. for (let v = v; ; ) { } ~ !!! error TS2448: Block-scoped variable 'v' used before its declaration. +!!! related TS2728 tests/cases/compiler/recursiveLetConst.ts:6:10: 'v' was declared here. for (let [v] = v; ;) { } ~ !!! error TS2448: Block-scoped variable 'v' used before its declaration. +!!! related TS2728 tests/cases/compiler/recursiveLetConst.ts:7:11: 'v' was declared here. for (let v in v) { } ~ !!! error TS2448: Block-scoped variable 'v' used before its declaration. +!!! related TS2728 tests/cases/compiler/recursiveLetConst.ts:8:10: 'v' was declared here. for (let v of v) { } ~ !!! error TS2448: Block-scoped variable 'v' used before its declaration. +!!! related TS2728 tests/cases/compiler/recursiveLetConst.ts:9:10: 'v' was declared here. for (let [v] of v) { } ~ !!! error TS2448: Block-scoped variable 'v' used before its declaration. +!!! related TS2728 tests/cases/compiler/recursiveLetConst.ts:10:11: 'v' was declared here. let [x2 = x2] = [] ~~ !!! error TS2448: Block-scoped variable 'x2' used before its declaration. +!!! related TS2728 tests/cases/compiler/recursiveLetConst.ts:11:6: 'x2' was declared here. let z0 = () => z0; let z1 = function () { return z1; } let z2 = { f() { return z2;}} \ No newline at end of file diff --git a/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.errors.txt b/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.errors.txt index bfb9a5127f8f7..5e347bff0c3fd 100644 --- a/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.errors.txt +++ b/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.errors.txt @@ -29,6 +29,7 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53 export class caniventer extends Lanthanum.nitidus { ~~~~~~~ !!! error TS2449: Class 'nitidus' used before its declaration. +!!! related TS2728 tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts:114:16: 'nitidus' was declared here. salomonseni() : caniventer { var x : caniventer; () => { var y = this; }; return x; } uchidai() : lavali.xanthognathus { var x : lavali.xanthognathus; () => { var y = this; }; return x; } raffrayana() : lavali.otion { var x : lavali.otion; () => { var y = this; }; return x; } @@ -38,6 +39,7 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53 export class veraecrucis extends trivirgatus.mixtus { ~~~~~~ !!! error TS2449: Class 'mixtus' used before its declaration. +!!! related TS2728 tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts:199:16: 'mixtus' was declared here. naso() : panamensis.setulosus> { var x : panamensis.setulosus>; () => { var y = this; }; return x; } vancouverensis() : imperfecta.ciliolabrum { var x : imperfecta.ciliolabrum; () => { var y = this; }; return x; } africana() : argurus.gilbertii, sagitta.cinereus> { var x : argurus.gilbertii, sagitta.cinereus>; () => { var y = this; }; return x; } @@ -76,6 +78,7 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53 export class oralis extends caurinus.psilurus { ~~~~~~~~ !!! error TS2449: Class 'psilurus' used before its declaration. +!!! related TS2728 tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts:1010:18: 'psilurus' was declared here. cepapi() : caurinus.psilurus { var x : caurinus.psilurus; () => { var y = this; }; return x; } porteri() : lavali.thaeleri { var x : lavali.thaeleri; () => { var y = this; }; return x; } bindi() : caurinus.mahaganus> { var x : caurinus.mahaganus>; () => { var y = this; }; return x; } @@ -93,6 +96,7 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53 export class sumatrana extends Lanthanum.jugularis { ~~~~~~~~~ !!! error TS2449: Class 'jugularis' used before its declaration. +!!! related TS2728 tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts:136:16: 'jugularis' was declared here. wolffsohni() : Lanthanum.suillus { var x : Lanthanum.suillus; () => { var y = this; }; return x; } geata() : ruatanica.hector { var x : ruatanica.hector; () => { var y = this; }; return x; } awashensis() : petrophilus.minutilla { var x : petrophilus.minutilla; () => { var y = this; }; return x; } @@ -131,6 +135,7 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53 export class durangae extends dogramacii.aurata { ~~~~~~ !!! error TS2449: Class 'aurata' used before its declaration. +!!! related TS2728 tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts:346:16: 'aurata' was declared here. Californium() : panamensis.setulosus { var x : panamensis.setulosus; () => { var y = this; }; return x; } Flerovium() : howi.angulatus { var x : howi.angulatus; () => { var y = this; }; return x; } phrudus() : sagitta.stolzmanni { var x : sagitta.stolzmanni; () => { var y = this; }; return x; } @@ -151,6 +156,7 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53 export class nitidus extends argurus.gilbertii { ~~~~~~~~~ !!! error TS2449: Class 'gilbertii' used before its declaration. +!!! related TS2728 tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts:702:18: 'gilbertii' was declared here. granatensis() : quasiater.bobrinskoi { var x : quasiater.bobrinskoi; () => { var y = this; }; return x; } negligens() : minutus.inez { var x : minutus.inez; () => { var y = this; }; return x; } lewisi() : julianae.oralis { var x : julianae.oralis; () => { var y = this; }; return x; } @@ -165,6 +171,7 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53 export class megalonyx extends caurinus.johorensis { ~~~~~~~~~~ !!! error TS2449: Class 'johorensis' used before its declaration. +!!! related TS2728 tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts:979:18: 'johorensis' was declared here. phillipsii() : macrorhinos.konganensis { var x : macrorhinos.konganensis; () => { var y = this; }; return x; } melanogaster() : rionegrensis.veraecrucis { var x : rionegrensis.veraecrucis; () => { var y = this; }; return x; } elaphus() : nitidus { var x : nitidus; () => { var y = this; }; return x; } @@ -223,6 +230,7 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53 export class crenulata extends trivirgatus.falconeri { ~~~~~~~~~ !!! error TS2449: Class 'falconeri' used before its declaration. +!!! related TS2728 tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts:212:16: 'falconeri' was declared here. salvanius() : howi.coludo { var x : howi.coludo; () => { var y = this; }; return x; } maritimus() : ruatanica.americanus { var x : ruatanica.americanus; () => { var y = this; }; return x; } edax() : lutreolus.cor>, rionegrensis.caniventer> { var x : lutreolus.cor>, rionegrensis.caniventer>; () => { var y = this; }; return x; } @@ -242,6 +250,7 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53 export class mixtus extends argurus.pygmaea> { ~~~~~~~ !!! error TS2449: Class 'pygmaea' used before its declaration. +!!! related TS2728 tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts:598:18: 'pygmaea' was declared here. ochrogaster() : dogramacii.aurata { var x : dogramacii.aurata; () => { var y = this; }; return x; } bryophilus() : macrorhinos.marmosurus>> { var x : macrorhinos.marmosurus>>; () => { var y = this; }; return x; } liechtensteini() : rendalli.zuluensis { var x : rendalli.zuluensis; () => { var y = this; }; return x; } @@ -292,6 +301,7 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53 export class americanus extends imperfecta.ciliolabrum { ~~~~~~~~~~~ !!! error TS2449: Class 'ciliolabrum' used before its declaration. +!!! related TS2728 tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts:809:18: 'ciliolabrum' was declared here. nasoloi() : macrorhinos.konganensis { var x : macrorhinos.konganensis; () => { var y = this; }; return x; } mystacalis() : howi.angulatus { var x : howi.angulatus; () => { var y = this; }; return x; } fardoulisi() : trivirgatus.oconnelli { var x : trivirgatus.oconnelli; () => { var y = this; }; return x; } @@ -319,6 +329,7 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53 export class otion extends howi.coludo { ~~~~~~ !!! error TS2449: Class 'coludo' used before its declaration. +!!! related TS2728 tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts:889:18: 'coludo' was declared here. bonaerensis() : provocax.melanoleuca { var x : provocax.melanoleuca; () => { var y = this; }; return x; } dussumieri() : nigra.gracilis { var x : nigra.gracilis; () => { var y = this; }; return x; } osvaldoreigi() : julianae.albidens { var x : julianae.albidens; () => { var y = this; }; return x; } @@ -350,6 +361,7 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53 export class thaeleri extends argurus.oreas { ~~~~~ !!! error TS2449: Class 'oreas' used before its declaration. +!!! related TS2728 tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts:627:18: 'oreas' was declared here. coromandra() : julianae.galapagoensis { var x : julianae.galapagoensis; () => { var y = this; }; return x; } parvipes() : nigra.dolichurus { var x : nigra.dolichurus; () => { var y = this; }; return x; } sponsorius() : rionegrensis.veraecrucis, julianae.steerii> { var x : rionegrensis.veraecrucis, julianae.steerii>; () => { var y = this; }; return x; } @@ -454,6 +466,7 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53 export class amphibius extends caurinus.johorensis, Lanthanum.jugularis> { ~~~~~~~~~~ !!! error TS2449: Class 'johorensis' used before its declaration. +!!! related TS2728 tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts:979:18: 'johorensis' was declared here. bottegi(): macrorhinos.marmosurus, gabriellae.echinatus>, sagitta.stolzmanni> { var x: macrorhinos.marmosurus, gabriellae.echinatus>, sagitta.stolzmanni>; () => { var y = this; }; return x; } jerdoni(): macrorhinos.daphaenodon { var x: macrorhinos.daphaenodon; () => { var y = this; }; return x; } camtschatica(): samarensis.pallidus { var x: samarensis.pallidus; () => { var y = this; }; return x; } @@ -489,6 +502,7 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53 export class himalayana extends lutreolus.punicus { ~~~~~~~ !!! error TS2449: Class 'punicus' used before its declaration. +!!! related TS2728 tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts:722:18: 'punicus' was declared here. simoni(): argurus.netscheri> { var x: argurus.netscheri>; () => { var y = this; }; return x; } lobata(): samarensis.pallidus { var x: samarensis.pallidus; () => { var y = this; }; return x; } rusticus(): dogramacii.aurata { var x: dogramacii.aurata; () => { var y = this; }; return x; } @@ -524,6 +538,7 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53 export class angulatus extends sagitta.stolzmanni { ~~~~~~~~~~ !!! error TS2449: Class 'stolzmanni' used before its declaration. +!!! related TS2728 tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts:901:18: 'stolzmanni' was declared here. pennatus(): howi.marcanoi { var x: howi.marcanoi; () => { var y = this; }; return x; } } } @@ -547,6 +562,7 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53 export class walkeri extends minutus.portoricensis { ~~~~~~~~~~~~~ !!! error TS2449: Class 'portoricensis' used before its declaration. +!!! related TS2728 tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts:851:18: 'portoricensis' was declared here. maracajuensis(): samarensis.cahirinus { var x: samarensis.cahirinus; () => { var y = this; }; return x; } } } @@ -554,6 +570,7 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53 export class inez extends samarensis.pelurus { ~~~~~~~ !!! error TS2449: Class 'pelurus' used before its declaration. +!!! related TS2728 tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts:534:18: 'pelurus' was declared here. vexillaris(): samarensis.cahirinus { var x: samarensis.cahirinus; () => { var y = this; }; return x; } } } @@ -561,6 +578,7 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53 export class konganensis extends imperfecta.lasiurus { ~~~~~~~~ !!! error TS2449: Class 'lasiurus' used before its declaration. +!!! related TS2728 tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts:788:18: 'lasiurus' was declared here. } } module panamensis { @@ -597,6 +615,7 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53 export class pelurus extends sagitta.stolzmanni { ~~~~~~~~~~ !!! error TS2449: Class 'stolzmanni' used before its declaration. +!!! related TS2728 tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts:901:18: 'stolzmanni' was declared here. Palladium(): panamensis.linulus { var x: panamensis.linulus; () => { var y = this; }; return x; } castanea(): argurus.netscheri, julianae.oralis> { var x: argurus.netscheri, julianae.oralis>; () => { var y = this; }; return x; } chamek(): argurus.pygmaea { var x: argurus.pygmaea; () => { var y = this; }; return x; } @@ -614,6 +633,7 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53 export class fuscus extends macrorhinos.daphaenodon { ~~~~~~~~~~~ !!! error TS2449: Class 'daphaenodon' used before its declaration. +!!! related TS2728 tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts:739:18: 'daphaenodon' was declared here. planifrons(): nigra.gracilis { var x: nigra.gracilis; () => { var y = this; }; return x; } badia(): julianae.sumatrana { var x: julianae.sumatrana; () => { var y = this; }; return x; } prymnolopha(): sagitta.walkeri { var x: sagitta.walkeri; () => { var y = this; }; return x; } @@ -647,6 +667,7 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53 export class leptoceros extends caurinus.johorensis> { ~~~~~~~~~~ !!! error TS2449: Class 'johorensis' used before its declaration. +!!! related TS2728 tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts:979:18: 'johorensis' was declared here. victus(): rionegrensis.caniventer { var x: rionegrensis.caniventer; () => { var y = this; }; return x; } hoplomyoides(): panglima.fundatus, nigra.gracilis> { var x: panglima.fundatus, nigra.gracilis>; () => { var y = this; }; return x; } gratiosus(): lavali.lepturus { var x: lavali.lepturus; () => { var y = this; }; return x; } @@ -658,6 +679,7 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53 export class nigricans extends sagitta.stolzmanni { ~~~~~~~~~~ !!! error TS2449: Class 'stolzmanni' used before its declaration. +!!! related TS2728 tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts:901:18: 'stolzmanni' was declared here. woosnami(): dogramacii.robustulus { var x: dogramacii.robustulus; () => { var y = this; }; return x; } } } @@ -676,6 +698,7 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53 export class sarasinorum extends caurinus.psilurus { ~~~~~~~~ !!! error TS2449: Class 'psilurus' used before its declaration. +!!! related TS2728 tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts:1010:18: 'psilurus' was declared here. belzebul(): samarensis.pallidus { var x: samarensis.pallidus; () => { var y = this; }; return x; } hinpoon(): nigra.caucasica { var x: nigra.caucasica; () => { var y = this; }; return x; } kandti(): quasiater.wattsi { var x: quasiater.wattsi; () => { var y = this; }; return x; } @@ -842,6 +865,7 @@ tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts(769,53 export class klossii extends imperfecta.lasiurus { ~~~~~~~~ !!! error TS2449: Class 'lasiurus' used before its declaration. +!!! related TS2728 tests/cases/compiler/resolvingClassDeclarationWhenInBaseTypeResolution.ts:788:18: 'lasiurus' was declared here. } export class amicus { pirrensis(): argurus.luctuosa { var x: argurus.luctuosa; () => { var y = this; }; return x; } diff --git a/tests/baselines/reference/scopeCheckStaticInitializer.errors.txt b/tests/baselines/reference/scopeCheckStaticInitializer.errors.txt index c023c356a2a59..acf9f8d86c535 100644 --- a/tests/baselines/reference/scopeCheckStaticInitializer.errors.txt +++ b/tests/baselines/reference/scopeCheckStaticInitializer.errors.txt @@ -9,16 +9,20 @@ tests/cases/compiler/scopeCheckStaticInitializer.ts(6,23): error TS2449: Class ' static illegalBeforeProperty = X.data; ~~~~ !!! error TS2448: Block-scoped variable 'data' used before its declaration. +!!! related TS2728 tests/cases/compiler/scopeCheckStaticInitializer.ts:7:12: 'data' was declared here. static okBeforeMethod = X.method; static illegal2 = After.data; ~~~~~ !!! error TS2449: Class 'After' used before its declaration. +!!! related TS2728 tests/cases/compiler/scopeCheckStaticInitializer.ts:10:7: 'After' was declared here. ~~~~ !!! error TS2448: Block-scoped variable 'data' used before its declaration. +!!! related TS2728 tests/cases/compiler/scopeCheckStaticInitializer.ts:11:12: 'data' was declared here. static illegal3 = After.method; ~~~~~ !!! error TS2449: Class 'After' used before its declaration. +!!! related TS2728 tests/cases/compiler/scopeCheckStaticInitializer.ts:10:7: 'After' was declared here. static data = 13; static method() { } } diff --git a/tests/baselines/reference/symbolProperty33.errors.txt b/tests/baselines/reference/symbolProperty33.errors.txt index a8e95fc5bd8cb..0b6672903f508 100644 --- a/tests/baselines/reference/symbolProperty33.errors.txt +++ b/tests/baselines/reference/symbolProperty33.errors.txt @@ -6,6 +6,7 @@ tests/cases/conformance/es6/Symbols/symbolProperty33.ts(7,6): error TS1023: An i class C1 extends C2 { ~~ !!! error TS2449: Class 'C2' used before its declaration. +!!! related TS2728 tests/cases/conformance/es6/Symbols/symbolProperty33.ts:6:7: 'C2' was declared here. [Symbol.toStringTag]() { return { x: "" }; } diff --git a/tests/baselines/reference/symbolProperty34.errors.txt b/tests/baselines/reference/symbolProperty34.errors.txt index 3ff62c12ad152..b7aae39174b3f 100644 --- a/tests/baselines/reference/symbolProperty34.errors.txt +++ b/tests/baselines/reference/symbolProperty34.errors.txt @@ -6,6 +6,7 @@ tests/cases/conformance/es6/Symbols/symbolProperty34.ts(7,6): error TS1023: An i class C1 extends C2 { ~~ !!! error TS2449: Class 'C2' used before its declaration. +!!! related TS2728 tests/cases/conformance/es6/Symbols/symbolProperty34.ts:6:7: 'C2' was declared here. [Symbol.toStringTag]() { return { x: "" }; } diff --git a/tests/baselines/reference/useBeforeDeclaration_propertyAssignment.errors.txt b/tests/baselines/reference/useBeforeDeclaration_propertyAssignment.errors.txt index f237fd07c807b..0efd967ccc044 100644 --- a/tests/baselines/reference/useBeforeDeclaration_propertyAssignment.errors.txt +++ b/tests/baselines/reference/useBeforeDeclaration_propertyAssignment.errors.txt @@ -6,6 +6,7 @@ tests/cases/compiler/useBeforeDeclaration_propertyAssignment.ts(2,27): error TS2 public a = { b: this.b }; ~ !!! error TS2448: Block-scoped variable 'b' used before its declaration. +!!! related TS2728 tests/cases/compiler/useBeforeDeclaration_propertyAssignment.ts:3:13: 'b' was declared here. private b = 0; } \ No newline at end of file diff --git a/tests/baselines/reference/useBeforeDeclaration_superClass.errors.txt b/tests/baselines/reference/useBeforeDeclaration_superClass.errors.txt index 01d714d8e6f0a..b8edc26caf188 100644 --- a/tests/baselines/reference/useBeforeDeclaration_superClass.errors.txt +++ b/tests/baselines/reference/useBeforeDeclaration_superClass.errors.txt @@ -29,6 +29,7 @@ tests/cases/compiler/useBeforeDeclaration_superClass.ts(25,18): error TS2448: Bl old_x = this.x; ~ !!! error TS2448: Block-scoped variable 'x' used before its declaration. +!!! related TS2728 tests/cases/compiler/useBeforeDeclaration_superClass.ts:26:5: 'x' was declared here. x = 1; } \ No newline at end of file