Accept new baselines
This commit is contained in:
parent
82fd5a884d
commit
87a8d41e11
4 changed files with 144 additions and 1 deletions
|
@ -2,9 +2,11 @@ tests/cases/conformance/classes/propertyMemberDeclarations/strictPropertyInitial
|
|||
tests/cases/conformance/classes/propertyMemberDeclarations/strictPropertyInitialization.ts(6,5): error TS2564: Property 'c' has no initializer and is not definitely assigned in the constructor.
|
||||
tests/cases/conformance/classes/propertyMemberDeclarations/strictPropertyInitialization.ts(48,5): error TS2564: Property 'a' has no initializer and is not definitely assigned in the constructor.
|
||||
tests/cases/conformance/classes/propertyMemberDeclarations/strictPropertyInitialization.ts(71,5): error TS2564: Property 'a' has no initializer and is not definitely assigned in the constructor.
|
||||
tests/cases/conformance/classes/propertyMemberDeclarations/strictPropertyInitialization.ts(93,22): error TS2565: Property 'a' is used before being assigned.
|
||||
tests/cases/conformance/classes/propertyMemberDeclarations/strictPropertyInitialization.ts(94,23): error TS2565: Property 'b' is used before being assigned.
|
||||
|
||||
|
||||
==== tests/cases/conformance/classes/propertyMemberDeclarations/strictPropertyInitialization.ts (4 errors) ====
|
||||
==== tests/cases/conformance/classes/propertyMemberDeclarations/strictPropertyInitialization.ts (6 errors) ====
|
||||
// Properties with non-undefined types require initialization
|
||||
|
||||
class C1 {
|
||||
|
@ -97,3 +99,22 @@ tests/cases/conformance/classes/propertyMemberDeclarations/strictPropertyInitial
|
|||
abstract d?: number;
|
||||
}
|
||||
|
||||
// Properties with non-undefined types must be assigned before they can be accessed
|
||||
// within their constructor
|
||||
|
||||
class C10 {
|
||||
a: number;
|
||||
b: number;
|
||||
c?: number;
|
||||
constructor() {
|
||||
let x = this.a; // Error
|
||||
~
|
||||
!!! error TS2565: Property 'a' is used before being assigned.
|
||||
this.a = this.b; // Error
|
||||
~
|
||||
!!! error TS2565: Property 'b' is used before being assigned.
|
||||
this.b = x;
|
||||
let y = this.c;
|
||||
}
|
||||
}
|
||||
|
|
@ -83,6 +83,21 @@ abstract class C9 {
|
|||
abstract d?: number;
|
||||
}
|
||||
|
||||
// Properties with non-undefined types must be assigned before they can be accessed
|
||||
// within their constructor
|
||||
|
||||
class C10 {
|
||||
a: number;
|
||||
b: number;
|
||||
c?: number;
|
||||
constructor() {
|
||||
let x = this.a; // Error
|
||||
this.a = this.b; // Error
|
||||
this.b = x;
|
||||
let y = this.c;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//// [strictPropertyInitialization.js]
|
||||
"use strict";
|
||||
|
@ -146,6 +161,17 @@ var C9 = /** @class */ (function () {
|
|||
}
|
||||
return C9;
|
||||
}());
|
||||
// Properties with non-undefined types must be assigned before they can be accessed
|
||||
// within their constructor
|
||||
var C10 = /** @class */ (function () {
|
||||
function C10() {
|
||||
var x = this.a; // Error
|
||||
this.a = this.b; // Error
|
||||
this.b = x;
|
||||
var y = this.c;
|
||||
}
|
||||
return C10;
|
||||
}());
|
||||
|
||||
|
||||
//// [strictPropertyInitialization.d.ts]
|
||||
|
@ -195,3 +221,9 @@ declare abstract class C9 {
|
|||
abstract c: number | null;
|
||||
abstract d?: number;
|
||||
}
|
||||
declare class C10 {
|
||||
a: number;
|
||||
b: number;
|
||||
c?: number;
|
||||
constructor();
|
||||
}
|
||||
|
|
|
@ -163,3 +163,47 @@ abstract class C9 {
|
|||
>d : Symbol(C9.d, Decl(strictPropertyInitialization.ts, 80, 30))
|
||||
}
|
||||
|
||||
// Properties with non-undefined types must be assigned before they can be accessed
|
||||
// within their constructor
|
||||
|
||||
class C10 {
|
||||
>C10 : Symbol(C10, Decl(strictPropertyInitialization.ts, 82, 1))
|
||||
|
||||
a: number;
|
||||
>a : Symbol(C10.a, Decl(strictPropertyInitialization.ts, 87, 11))
|
||||
|
||||
b: number;
|
||||
>b : Symbol(C10.b, Decl(strictPropertyInitialization.ts, 88, 14))
|
||||
|
||||
c?: number;
|
||||
>c : Symbol(C10.c, Decl(strictPropertyInitialization.ts, 89, 14))
|
||||
|
||||
constructor() {
|
||||
let x = this.a; // Error
|
||||
>x : Symbol(x, Decl(strictPropertyInitialization.ts, 92, 11))
|
||||
>this.a : Symbol(C10.a, Decl(strictPropertyInitialization.ts, 87, 11))
|
||||
>this : Symbol(C10, Decl(strictPropertyInitialization.ts, 82, 1))
|
||||
>a : Symbol(C10.a, Decl(strictPropertyInitialization.ts, 87, 11))
|
||||
|
||||
this.a = this.b; // Error
|
||||
>this.a : Symbol(C10.a, Decl(strictPropertyInitialization.ts, 87, 11))
|
||||
>this : Symbol(C10, Decl(strictPropertyInitialization.ts, 82, 1))
|
||||
>a : Symbol(C10.a, Decl(strictPropertyInitialization.ts, 87, 11))
|
||||
>this.b : Symbol(C10.b, Decl(strictPropertyInitialization.ts, 88, 14))
|
||||
>this : Symbol(C10, Decl(strictPropertyInitialization.ts, 82, 1))
|
||||
>b : Symbol(C10.b, Decl(strictPropertyInitialization.ts, 88, 14))
|
||||
|
||||
this.b = x;
|
||||
>this.b : Symbol(C10.b, Decl(strictPropertyInitialization.ts, 88, 14))
|
||||
>this : Symbol(C10, Decl(strictPropertyInitialization.ts, 82, 1))
|
||||
>b : Symbol(C10.b, Decl(strictPropertyInitialization.ts, 88, 14))
|
||||
>x : Symbol(x, Decl(strictPropertyInitialization.ts, 92, 11))
|
||||
|
||||
let y = this.c;
|
||||
>y : Symbol(y, Decl(strictPropertyInitialization.ts, 95, 11))
|
||||
>this.c : Symbol(C10.c, Decl(strictPropertyInitialization.ts, 89, 14))
|
||||
>this : Symbol(C10, Decl(strictPropertyInitialization.ts, 82, 1))
|
||||
>c : Symbol(C10.c, Decl(strictPropertyInitialization.ts, 89, 14))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -178,3 +178,49 @@ abstract class C9 {
|
|||
>d : number | undefined
|
||||
}
|
||||
|
||||
// Properties with non-undefined types must be assigned before they can be accessed
|
||||
// within their constructor
|
||||
|
||||
class C10 {
|
||||
>C10 : C10
|
||||
|
||||
a: number;
|
||||
>a : number
|
||||
|
||||
b: number;
|
||||
>b : number
|
||||
|
||||
c?: number;
|
||||
>c : number | undefined
|
||||
|
||||
constructor() {
|
||||
let x = this.a; // Error
|
||||
>x : number
|
||||
>this.a : number
|
||||
>this : this
|
||||
>a : number
|
||||
|
||||
this.a = this.b; // Error
|
||||
>this.a = this.b : number
|
||||
>this.a : number
|
||||
>this : this
|
||||
>a : number
|
||||
>this.b : number
|
||||
>this : this
|
||||
>b : number
|
||||
|
||||
this.b = x;
|
||||
>this.b = x : number
|
||||
>this.b : number
|
||||
>this : this
|
||||
>b : number
|
||||
>x : number
|
||||
|
||||
let y = this.c;
|
||||
>y : number | undefined
|
||||
>this.c : number | undefined
|
||||
>this : this
|
||||
>c : number | undefined
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue