improve test
This commit is contained in:
parent
231d0d1be4
commit
09f409cfcb
|
@ -1,21 +1,33 @@
|
|||
tests/cases/conformance/classes/propertyMemberDeclarations/assignParameterPropertyToPropertyDeclarationESNext.ts(2,16): error TS2729: Property 'foo' is used before its initialization.
|
||||
tests/cases/conformance/classes/propertyMemberDeclarations/assignParameterPropertyToPropertyDeclarationESNext.ts(7,16): error TS2729: Property 'foo' is used before its initialization.
|
||||
tests/cases/conformance/classes/propertyMemberDeclarations/assignParameterPropertyToPropertyDeclarationESNext.ts(2,16): error TS2729: Property 'bar' is used before its initialization.
|
||||
tests/cases/conformance/classes/propertyMemberDeclarations/assignParameterPropertyToPropertyDeclarationESNext.ts(3,16): error TS2729: Property 'foo' is used before its initialization.
|
||||
tests/cases/conformance/classes/propertyMemberDeclarations/assignParameterPropertyToPropertyDeclarationESNext.ts(9,17): error TS2729: Property 'baz' is used before its initialization.
|
||||
tests/cases/conformance/classes/propertyMemberDeclarations/assignParameterPropertyToPropertyDeclarationESNext.ts(10,16): error TS2729: Property 'foo' is used before its initialization.
|
||||
|
||||
|
||||
==== tests/cases/conformance/classes/propertyMemberDeclarations/assignParameterPropertyToPropertyDeclarationESNext.ts (2 errors) ====
|
||||
==== tests/cases/conformance/classes/propertyMemberDeclarations/assignParameterPropertyToPropertyDeclarationESNext.ts (4 errors) ====
|
||||
class C {
|
||||
qux = this.bar // should error
|
||||
~~~
|
||||
!!! error TS2729: Property 'bar' is used before its initialization.
|
||||
!!! related TS2728 tests/cases/conformance/classes/propertyMemberDeclarations/assignParameterPropertyToPropertyDeclarationESNext.ts:3:5: 'bar' is declared here.
|
||||
bar = this.foo // should error
|
||||
~~~
|
||||
!!! error TS2729: Property 'foo' is used before its initialization.
|
||||
!!! related TS2728 tests/cases/conformance/classes/propertyMemberDeclarations/assignParameterPropertyToPropertyDeclarationESNext.ts:6:17: 'foo' is declared here.
|
||||
!!! related TS2728 tests/cases/conformance/classes/propertyMemberDeclarations/assignParameterPropertyToPropertyDeclarationESNext.ts:8:17: 'foo' is declared here.
|
||||
quiz = this.bar // ok
|
||||
m1() {
|
||||
this.foo // ok
|
||||
}
|
||||
constructor(private foo: string) {}
|
||||
quim = this.baz // should error
|
||||
~~~
|
||||
!!! error TS2729: Property 'baz' is used before its initialization.
|
||||
!!! related TS2728 tests/cases/conformance/classes/propertyMemberDeclarations/assignParameterPropertyToPropertyDeclarationESNext.ts:10:5: 'baz' is declared here.
|
||||
baz = this.foo; // should error
|
||||
~~~
|
||||
!!! error TS2729: Property 'foo' is used before its initialization.
|
||||
!!! related TS2728 tests/cases/conformance/classes/propertyMemberDeclarations/assignParameterPropertyToPropertyDeclarationESNext.ts:6:17: 'foo' is declared here.
|
||||
!!! related TS2728 tests/cases/conformance/classes/propertyMemberDeclarations/assignParameterPropertyToPropertyDeclarationESNext.ts:8:17: 'foo' is declared here.
|
||||
quid = this.baz // ok
|
||||
m2() {
|
||||
this.foo // ok
|
||||
}
|
||||
|
|
|
@ -1,11 +1,15 @@
|
|||
//// [assignParameterPropertyToPropertyDeclarationESNext.ts]
|
||||
class C {
|
||||
qux = this.bar // should error
|
||||
bar = this.foo // should error
|
||||
quiz = this.bar // ok
|
||||
m1() {
|
||||
this.foo // ok
|
||||
}
|
||||
constructor(private foo: string) {}
|
||||
quim = this.baz // should error
|
||||
baz = this.foo; // should error
|
||||
quid = this.baz // ok
|
||||
m2() {
|
||||
this.foo // ok
|
||||
}
|
||||
|
@ -15,14 +19,18 @@ class C {
|
|||
//// [assignParameterPropertyToPropertyDeclarationESNext.js]
|
||||
class C {
|
||||
foo;
|
||||
qux = this.bar; // should error
|
||||
bar = this.foo; // should error
|
||||
quiz = this.bar; // ok
|
||||
m1() {
|
||||
this.foo; // ok
|
||||
}
|
||||
constructor(foo) {
|
||||
this.foo = foo;
|
||||
}
|
||||
quim = this.baz; // should error
|
||||
baz = this.foo; // should error
|
||||
quid = this.baz; // ok
|
||||
m2() {
|
||||
this.foo; // ok
|
||||
}
|
||||
|
|
|
@ -2,36 +2,60 @@
|
|||
class C {
|
||||
>C : Symbol(C, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 0, 0))
|
||||
|
||||
bar = this.foo // should error
|
||||
>bar : Symbol(C.bar, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 0, 9))
|
||||
>this.foo : Symbol(C.foo, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 5, 16))
|
||||
qux = this.bar // should error
|
||||
>qux : Symbol(C.qux, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 0, 9))
|
||||
>this.bar : Symbol(C.bar, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 1, 18))
|
||||
>this : Symbol(C, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 0, 0))
|
||||
>foo : Symbol(C.foo, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 5, 16))
|
||||
>bar : Symbol(C.bar, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 1, 18))
|
||||
|
||||
bar = this.foo // should error
|
||||
>bar : Symbol(C.bar, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 1, 18))
|
||||
>this.foo : Symbol(C.foo, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 7, 16))
|
||||
>this : Symbol(C, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 0, 0))
|
||||
>foo : Symbol(C.foo, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 7, 16))
|
||||
|
||||
quiz = this.bar // ok
|
||||
>quiz : Symbol(C.quiz, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 2, 18))
|
||||
>this.bar : Symbol(C.bar, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 1, 18))
|
||||
>this : Symbol(C, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 0, 0))
|
||||
>bar : Symbol(C.bar, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 1, 18))
|
||||
|
||||
m1() {
|
||||
>m1 : Symbol(C.m1, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 1, 18))
|
||||
>m1 : Symbol(C.m1, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 3, 19))
|
||||
|
||||
this.foo // ok
|
||||
>this.foo : Symbol(C.foo, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 5, 16))
|
||||
>this.foo : Symbol(C.foo, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 7, 16))
|
||||
>this : Symbol(C, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 0, 0))
|
||||
>foo : Symbol(C.foo, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 5, 16))
|
||||
>foo : Symbol(C.foo, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 7, 16))
|
||||
}
|
||||
constructor(private foo: string) {}
|
||||
>foo : Symbol(C.foo, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 5, 16))
|
||||
>foo : Symbol(C.foo, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 7, 16))
|
||||
|
||||
quim = this.baz // should error
|
||||
>quim : Symbol(C.quim, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 7, 39))
|
||||
>this.baz : Symbol(C.baz, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 8, 19))
|
||||
>this : Symbol(C, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 0, 0))
|
||||
>baz : Symbol(C.baz, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 8, 19))
|
||||
|
||||
baz = this.foo; // should error
|
||||
>baz : Symbol(C.baz, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 5, 39))
|
||||
>this.foo : Symbol(C.foo, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 5, 16))
|
||||
>baz : Symbol(C.baz, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 8, 19))
|
||||
>this.foo : Symbol(C.foo, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 7, 16))
|
||||
>this : Symbol(C, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 0, 0))
|
||||
>foo : Symbol(C.foo, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 5, 16))
|
||||
>foo : Symbol(C.foo, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 7, 16))
|
||||
|
||||
quid = this.baz // ok
|
||||
>quid : Symbol(C.quid, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 9, 19))
|
||||
>this.baz : Symbol(C.baz, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 8, 19))
|
||||
>this : Symbol(C, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 0, 0))
|
||||
>baz : Symbol(C.baz, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 8, 19))
|
||||
|
||||
m2() {
|
||||
>m2 : Symbol(C.m2, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 6, 19))
|
||||
>m2 : Symbol(C.m2, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 10, 19))
|
||||
|
||||
this.foo // ok
|
||||
>this.foo : Symbol(C.foo, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 5, 16))
|
||||
>this.foo : Symbol(C.foo, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 7, 16))
|
||||
>this : Symbol(C, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 0, 0))
|
||||
>foo : Symbol(C.foo, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 5, 16))
|
||||
>foo : Symbol(C.foo, Decl(assignParameterPropertyToPropertyDeclarationESNext.ts, 7, 16))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,12 +2,24 @@
|
|||
class C {
|
||||
>C : C
|
||||
|
||||
qux = this.bar // should error
|
||||
>qux : string
|
||||
>this.bar : string
|
||||
>this : this
|
||||
>bar : string
|
||||
|
||||
bar = this.foo // should error
|
||||
>bar : string
|
||||
>this.foo : string
|
||||
>this : this
|
||||
>foo : string
|
||||
|
||||
quiz = this.bar // ok
|
||||
>quiz : string
|
||||
>this.bar : string
|
||||
>this : this
|
||||
>bar : string
|
||||
|
||||
m1() {
|
||||
>m1 : () => void
|
||||
|
||||
|
@ -19,12 +31,24 @@ class C {
|
|||
constructor(private foo: string) {}
|
||||
>foo : string
|
||||
|
||||
quim = this.baz // should error
|
||||
>quim : string
|
||||
>this.baz : string
|
||||
>this : this
|
||||
>baz : string
|
||||
|
||||
baz = this.foo; // should error
|
||||
>baz : string
|
||||
>this.foo : string
|
||||
>this : this
|
||||
>foo : string
|
||||
|
||||
quid = this.baz // ok
|
||||
>quid : string
|
||||
>this.baz : string
|
||||
>this : this
|
||||
>baz : string
|
||||
|
||||
m2() {
|
||||
>m2 : () => void
|
||||
|
||||
|
|
|
@ -1,12 +1,16 @@
|
|||
// @useDefineForClassFields: true
|
||||
// @target: esnext
|
||||
class C {
|
||||
qux = this.bar // should error
|
||||
bar = this.foo // should error
|
||||
quiz = this.bar // ok
|
||||
m1() {
|
||||
this.foo // ok
|
||||
}
|
||||
constructor(private foo: string) {}
|
||||
quim = this.baz // should error
|
||||
baz = this.foo; // should error
|
||||
quid = this.baz // ok
|
||||
m2() {
|
||||
this.foo // ok
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue