Accepted baselines.

This commit is contained in:
Daniel Rosenwasser
2015-10-27 15:23:51 -07:00
parent 002bb6f04b
commit 7426aca392
6 changed files with 231 additions and 0 deletions
@@ -0,0 +1,47 @@
tests/cases/conformance/types/typeRelationships/matchable/equalityWithUnionTypes01.ts(13,5): error TS2365: Operator '===' cannot be applied to types 'number | I2' and 'I1'.
tests/cases/conformance/types/typeRelationships/matchable/equalityWithUnionTypes01.ts(13,16): error TS2365: Operator '===' cannot be applied to types 'I1' and 'number | I2'.
tests/cases/conformance/types/typeRelationships/matchable/equalityWithUnionTypes01.ts(15,10): error TS2365: Operator '!==' cannot be applied to types 'number | I2' and 'I1'.
tests/cases/conformance/types/typeRelationships/matchable/equalityWithUnionTypes01.ts(15,21): error TS2365: Operator '!==' cannot be applied to types 'I1' and 'number | I2'.
tests/cases/conformance/types/typeRelationships/matchable/equalityWithUnionTypes01.ts(17,10): error TS2365: Operator '==' cannot be applied to types 'number | I2' and 'I1'.
tests/cases/conformance/types/typeRelationships/matchable/equalityWithUnionTypes01.ts(17,20): error TS2365: Operator '==' cannot be applied to types 'I1' and 'number | I2'.
tests/cases/conformance/types/typeRelationships/matchable/equalityWithUnionTypes01.ts(19,10): error TS2365: Operator '!=' cannot be applied to types 'number | I2' and 'I1'.
tests/cases/conformance/types/typeRelationships/matchable/equalityWithUnionTypes01.ts(19,20): error TS2365: Operator '!=' cannot be applied to types 'I1' and 'number | I2'.
==== tests/cases/conformance/types/typeRelationships/matchable/equalityWithUnionTypes01.ts (8 errors) ====
interface I1 {
p1: number
}
interface I2 extends I1 {
p2: number;
}
var x = { p1: 10, p2: 20 };
var y: number | I2 = x;
var z: I1 = x;
if (y === z || z === y) {
~~~~~~~
!!! error TS2365: Operator '===' cannot be applied to types 'number | I2' and 'I1'.
~~~~~~~
!!! error TS2365: Operator '===' cannot be applied to types 'I1' and 'number | I2'.
}
else if (y !== z || z !== y) {
~~~~~~~
!!! error TS2365: Operator '!==' cannot be applied to types 'number | I2' and 'I1'.
~~~~~~~
!!! error TS2365: Operator '!==' cannot be applied to types 'I1' and 'number | I2'.
}
else if (y == z || z == y) {
~~~~~~
!!! error TS2365: Operator '==' cannot be applied to types 'number | I2' and 'I1'.
~~~~~~
!!! error TS2365: Operator '==' cannot be applied to types 'I1' and 'number | I2'.
}
else if (y != z || z != y) {
~~~~~~
!!! error TS2365: Operator '!=' cannot be applied to types 'number | I2' and 'I1'.
~~~~~~
!!! error TS2365: Operator '!=' cannot be applied to types 'I1' and 'number | I2'.
}
@@ -0,0 +1,34 @@
//// [equalityWithUnionTypes01.ts]
interface I1 {
p1: number
}
interface I2 extends I1 {
p2: number;
}
var x = { p1: 10, p2: 20 };
var y: number | I2 = x;
var z: I1 = x;
if (y === z || z === y) {
}
else if (y !== z || z !== y) {
}
else if (y == z || z == y) {
}
else if (y != z || z != y) {
}
//// [equalityWithUnionTypes01.js]
var x = { p1: 10, p2: 20 };
var y = x;
var z = x;
if (y === z || z === y) {
}
else if (y !== z || z !== y) {
}
else if (y == z || z == y) {
}
else if (y != z || z != y) {
}
@@ -0,0 +1,40 @@
tests/cases/conformance/types/typeRelationships/matchable/switchCaseWithUnionTypes01.ts(19,10): error TS2322: Type 'number | boolean' is not assignable to type 'string | number'.
Type 'boolean' is not assignable to type 'string | number'.
Type 'boolean' is not assignable to type 'number'.
tests/cases/conformance/types/typeRelationships/matchable/switchCaseWithUnionTypes01.ts(23,10): error TS2322: Type 'boolean' is not assignable to type 'string | number'.
Type 'boolean' is not assignable to type 'number'.
==== tests/cases/conformance/types/typeRelationships/matchable/switchCaseWithUnionTypes01.ts (2 errors) ====
var strOrNum: string | number;
var numOrBool: number | boolean;
var str: string;
var num: number;
var bool: boolean;
switch (strOrNum) {
// Identical
case strOrNum:
break;
// Constituents
case str:
case num:
break;
// Overlap in constituents
case numOrBool:
~~~~~~~~~
!!! error TS2322: Type 'number | boolean' is not assignable to type 'string | number'.
!!! error TS2322: Type 'boolean' is not assignable to type 'string | number'.
!!! error TS2322: Type 'boolean' is not assignable to type 'number'.
break;
// No relation
case bool:
~~~~
!!! error TS2322: Type 'boolean' is not assignable to type 'string | number'.
!!! error TS2322: Type 'boolean' is not assignable to type 'number'.
break;
}
@@ -0,0 +1,48 @@
//// [switchCaseWithUnionTypes01.ts]
var strOrNum: string | number;
var numOrBool: number | boolean;
var str: string;
var num: number;
var bool: boolean;
switch (strOrNum) {
// Identical
case strOrNum:
break;
// Constituents
case str:
case num:
break;
// Overlap in constituents
case numOrBool:
break;
// No relation
case bool:
break;
}
//// [switchCaseWithUnionTypes01.js]
var strOrNum;
var numOrBool;
var str;
var num;
var bool;
switch (strOrNum) {
// Identical
case strOrNum:
break;
// Constituents
case str:
case num:
break;
// Overlap in constituents
case numOrBool:
break;
// No relation
case bool:
break;
}
@@ -0,0 +1,35 @@
tests/cases/conformance/types/typeRelationships/matchable/typeAssertionsWithUnionTypes01.ts(13,9): error TS2352: Neither type 'I1' nor type 'number | I2' is assignable to the other.
Type 'I1' is not assignable to type 'I2'.
Property 'p2' is missing in type 'I1'.
tests/cases/conformance/types/typeRelationships/matchable/typeAssertionsWithUnionTypes01.ts(14,9): error TS2352: Neither type 'I1' nor type 'number' is assignable to the other.
tests/cases/conformance/types/typeRelationships/matchable/typeAssertionsWithUnionTypes01.ts(16,9): error TS2352: Neither type 'number | I2' nor type 'I1' is assignable to the other.
Type 'number' is not assignable to type 'I1'.
==== tests/cases/conformance/types/typeRelationships/matchable/typeAssertionsWithUnionTypes01.ts (3 errors) ====
interface I1 {
p1: number
}
interface I2 extends I1 {
p2: number;
}
var x = { p1: 10, p2: 20 };
var y: number | I2 = x;
var z: I1 = x;
var a = <number | I2>z;
~~~~~~~~~~~~~~
!!! error TS2352: Neither type 'I1' nor type 'number | I2' is assignable to the other.
!!! error TS2352: Type 'I1' is not assignable to type 'I2'.
!!! error TS2352: Property 'p2' is missing in type 'I1'.
var b = <number>z;
~~~~~~~~~
!!! error TS2352: Neither type 'I1' nor type 'number' is assignable to the other.
var c = <I2>z;
var d = <I1>y;
~~~~~
!!! error TS2352: Neither type 'number | I2' nor type 'I1' is assignable to the other.
!!! error TS2352: Type 'number' is not assignable to type 'I1'.
@@ -0,0 +1,27 @@
//// [typeAssertionsWithUnionTypes01.ts]
interface I1 {
p1: number
}
interface I2 extends I1 {
p2: number;
}
var x = { p1: 10, p2: 20 };
var y: number | I2 = x;
var z: I1 = x;
var a = <number | I2>z;
var b = <number>z;
var c = <I2>z;
var d = <I1>y;
//// [typeAssertionsWithUnionTypes01.js]
var x = { p1: 10, p2: 20 };
var y = x;
var z = x;
var a = z;
var b = z;
var c = z;
var d = y;