Add tests from review
This commit is contained in:
parent
cc1d8cf395
commit
ff0138878d
|
@ -1,16 +1,18 @@
|
|||
tests/cases/compiler/enumAssignmentCompat3.ts(37,1): error TS2322: Type 'Abcd.E' is not assignable to type 'First.E'.
|
||||
tests/cases/compiler/enumAssignmentCompat3.ts(49,1): error TS2322: Type 'Abcd.E' is not assignable to type 'First.E'.
|
||||
Property 'd' is missing in type 'First.E'.
|
||||
tests/cases/compiler/enumAssignmentCompat3.ts(39,1): error TS2322: Type 'Cd.E' is not assignable to type 'First.E'.
|
||||
tests/cases/compiler/enumAssignmentCompat3.ts(51,1): error TS2322: Type 'Cd.E' is not assignable to type 'First.E'.
|
||||
Property 'd' is missing in type 'First.E'.
|
||||
tests/cases/compiler/enumAssignmentCompat3.ts(40,1): error TS2322: Type 'Nope' is not assignable to type 'E'.
|
||||
tests/cases/compiler/enumAssignmentCompat3.ts(43,1): error TS2322: Type 'First.E' is not assignable to type 'Ab.E'.
|
||||
tests/cases/compiler/enumAssignmentCompat3.ts(52,1): error TS2322: Type 'Nope' is not assignable to type 'E'.
|
||||
tests/cases/compiler/enumAssignmentCompat3.ts(56,1): error TS2322: Type 'First.E' is not assignable to type 'Ab.E'.
|
||||
Property 'c' is missing in type 'Ab.E'.
|
||||
tests/cases/compiler/enumAssignmentCompat3.ts(44,1): error TS2322: Type 'First.E' is not assignable to type 'Cd.E'.
|
||||
tests/cases/compiler/enumAssignmentCompat3.ts(57,1): error TS2322: Type 'First.E' is not assignable to type 'Cd.E'.
|
||||
Property 'a' is missing in type 'Cd.E'.
|
||||
tests/cases/compiler/enumAssignmentCompat3.ts(45,1): error TS2322: Type 'E' is not assignable to type 'Nope'.
|
||||
tests/cases/compiler/enumAssignmentCompat3.ts(58,1): error TS2322: Type 'E' is not assignable to type 'Nope'.
|
||||
tests/cases/compiler/enumAssignmentCompat3.ts(62,1): error TS2322: Type 'Const.E' is not assignable to type 'First.E'.
|
||||
tests/cases/compiler/enumAssignmentCompat3.ts(63,1): error TS2322: Type 'First.E' is not assignable to type 'Const.E'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/enumAssignmentCompat3.ts (6 errors) ====
|
||||
==== tests/cases/compiler/enumAssignmentCompat3.ts (8 errors) ====
|
||||
namespace First {
|
||||
export enum E {
|
||||
a, b, c,
|
||||
|
@ -39,6 +41,16 @@ tests/cases/compiler/enumAssignmentCompat3.ts(45,1): error TS2322: Type 'E' is n
|
|||
c, d,
|
||||
}
|
||||
}
|
||||
namespace Const {
|
||||
export const enum E {
|
||||
a, b, c,
|
||||
}
|
||||
}
|
||||
namespace Decl {
|
||||
export declare enum E {
|
||||
a, b, c = 3,
|
||||
}
|
||||
}
|
||||
|
||||
var abc: First.E;
|
||||
var secondAbc: Abc.E;
|
||||
|
@ -46,6 +58,8 @@ tests/cases/compiler/enumAssignmentCompat3.ts(45,1): error TS2322: Type 'E' is n
|
|||
var secondAb: Ab.E;
|
||||
var secondCd: Cd.E;
|
||||
var nope: Abc.Nope;
|
||||
var k: Const.E;
|
||||
var decl: Decl.E;
|
||||
abc = secondAbc; // ok
|
||||
abc = secondAbcd; // missing 'd'
|
||||
~~~
|
||||
|
@ -59,6 +73,7 @@ tests/cases/compiler/enumAssignmentCompat3.ts(45,1): error TS2322: Type 'E' is n
|
|||
abc = nope; // nope!
|
||||
~~~
|
||||
!!! error TS2322: Type 'Nope' is not assignable to type 'E'.
|
||||
abc = decl; // ok
|
||||
secondAbc = abc; // ok
|
||||
secondAbcd = abc; // ok
|
||||
secondAb = abc; // missing 'c'
|
||||
|
@ -72,4 +87,13 @@ tests/cases/compiler/enumAssignmentCompat3.ts(45,1): error TS2322: Type 'E' is n
|
|||
nope = abc; // nope!
|
||||
~~~~
|
||||
!!! error TS2322: Type 'E' is not assignable to type 'Nope'.
|
||||
decl = abc; // ok
|
||||
|
||||
k = k; // const is only assignable to itself
|
||||
abc = k; // error
|
||||
~~~
|
||||
!!! error TS2322: Type 'Const.E' is not assignable to type 'First.E'.
|
||||
k = abc;
|
||||
~
|
||||
!!! error TS2322: Type 'First.E' is not assignable to type 'Const.E'.
|
||||
|
|
@ -27,6 +27,16 @@ namespace Cd {
|
|||
c, d,
|
||||
}
|
||||
}
|
||||
namespace Const {
|
||||
export const enum E {
|
||||
a, b, c,
|
||||
}
|
||||
}
|
||||
namespace Decl {
|
||||
export declare enum E {
|
||||
a, b, c = 3,
|
||||
}
|
||||
}
|
||||
|
||||
var abc: First.E;
|
||||
var secondAbc: Abc.E;
|
||||
|
@ -34,16 +44,24 @@ var secondAbcd: Abcd.E;
|
|||
var secondAb: Ab.E;
|
||||
var secondCd: Cd.E;
|
||||
var nope: Abc.Nope;
|
||||
var k: Const.E;
|
||||
var decl: Decl.E;
|
||||
abc = secondAbc; // ok
|
||||
abc = secondAbcd; // missing 'd'
|
||||
abc = secondAb; // ok
|
||||
abc = secondCd; // missing 'd'
|
||||
abc = nope; // nope!
|
||||
abc = decl; // ok
|
||||
secondAbc = abc; // ok
|
||||
secondAbcd = abc; // ok
|
||||
secondAb = abc; // missing 'c'
|
||||
secondCd = abc; // missing 'a' and 'b'
|
||||
nope = abc; // nope!
|
||||
decl = abc; // ok
|
||||
|
||||
k = k; // const is only assignable to itself
|
||||
abc = k; // error
|
||||
k = abc;
|
||||
|
||||
|
||||
//// [enumAssignmentCompat3.js]
|
||||
|
@ -97,19 +115,29 @@ var Cd;
|
|||
})(Cd.E || (Cd.E = {}));
|
||||
var E = Cd.E;
|
||||
})(Cd || (Cd = {}));
|
||||
var Decl;
|
||||
(function (Decl) {
|
||||
})(Decl || (Decl = {}));
|
||||
var abc;
|
||||
var secondAbc;
|
||||
var secondAbcd;
|
||||
var secondAb;
|
||||
var secondCd;
|
||||
var nope;
|
||||
var k;
|
||||
var decl;
|
||||
abc = secondAbc; // ok
|
||||
abc = secondAbcd; // missing 'd'
|
||||
abc = secondAb; // ok
|
||||
abc = secondCd; // missing 'd'
|
||||
abc = nope; // nope!
|
||||
abc = decl; // ok
|
||||
secondAbc = abc; // ok
|
||||
secondAbcd = abc; // ok
|
||||
secondAb = abc; // missing 'c'
|
||||
secondCd = abc; // missing 'a' and 'b'
|
||||
nope = abc; // nope!
|
||||
decl = abc; // ok
|
||||
k = k; // const is only assignable to itself
|
||||
abc = k; // error
|
||||
k = abc;
|
||||
|
|
|
@ -26,6 +26,16 @@ namespace Cd {
|
|||
c, d,
|
||||
}
|
||||
}
|
||||
namespace Const {
|
||||
export const enum E {
|
||||
a, b, c,
|
||||
}
|
||||
}
|
||||
namespace Decl {
|
||||
export declare enum E {
|
||||
a, b, c = 3,
|
||||
}
|
||||
}
|
||||
|
||||
var abc: First.E;
|
||||
var secondAbc: Abc.E;
|
||||
|
@ -33,13 +43,21 @@ var secondAbcd: Abcd.E;
|
|||
var secondAb: Ab.E;
|
||||
var secondCd: Cd.E;
|
||||
var nope: Abc.Nope;
|
||||
var k: Const.E;
|
||||
var decl: Decl.E;
|
||||
abc = secondAbc; // ok
|
||||
abc = secondAbcd; // missing 'd'
|
||||
abc = secondAb; // ok
|
||||
abc = secondCd; // missing 'd'
|
||||
abc = nope; // nope!
|
||||
abc = decl; // ok
|
||||
secondAbc = abc; // ok
|
||||
secondAbcd = abc; // ok
|
||||
secondAb = abc; // missing 'c'
|
||||
secondCd = abc; // missing 'a' and 'b'
|
||||
nope = abc; // nope!
|
||||
decl = abc; // ok
|
||||
|
||||
k = k; // const is only assignable to itself
|
||||
abc = k; // error
|
||||
k = abc;
|
||||
|
|
Loading…
Reference in a new issue