This was we don't get noisy baselines just because a different phase of the compiler reported the diagnostic. This helps with Yui's refactoring work to move grammar checks into the type checker.
46 lines
No EOL
2 KiB
Text
46 lines
No EOL
2 KiB
Text
tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorParameters.ts(4,9): error TS2304: Cannot find name 'x'.
|
|
tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorParameters.ts(5,15): error TS2304: Cannot find name 'x'.
|
|
tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorParameters.ts(10,9): error TS2304: Cannot find name 'x'.
|
|
tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorParameters.ts(11,15): error TS2304: Cannot find name 'x'.
|
|
tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorParameters.ts(17,15): error TS1003: Identifier expected.
|
|
tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorParameters.ts(23,9): error TS2304: Cannot find name 'x'.
|
|
|
|
|
|
==== tests/cases/conformance/classes/propertyMemberDeclarations/initializerReferencingConstructorParameters.ts (6 errors) ====
|
|
// Initializer expressions for instance member variables are evaluated in the scope of the class constructor body but are not permitted to reference parameters or local variables of the constructor.
|
|
|
|
class C {
|
|
a = x; // error
|
|
~
|
|
!!! error TS2304: Cannot find name 'x'.
|
|
b: typeof x; // error
|
|
~
|
|
!!! error TS2304: Cannot find name 'x'.
|
|
constructor(x) { }
|
|
}
|
|
|
|
class D {
|
|
a = x; // error
|
|
~
|
|
!!! error TS2304: Cannot find name 'x'.
|
|
b: typeof x; // error
|
|
~
|
|
!!! error TS2304: Cannot find name 'x'.
|
|
constructor(public x) { }
|
|
}
|
|
|
|
class E {
|
|
a = this.x; // ok
|
|
b: typeof this.x; // error
|
|
~~~~
|
|
!!! error TS1003: Identifier expected.
|
|
constructor(public x) { }
|
|
}
|
|
|
|
class F<T> {
|
|
a = this.x; // ok
|
|
b = x; // error
|
|
~
|
|
!!! error TS2304: Cannot find name 'x'.
|
|
constructor(public x: T) { }
|
|
} |