Accepted baselines.

This commit is contained in:
Daniel Rosenwasser
2015-10-28 17:10:57 -07:00
parent bdb1db5ae4
commit 441dd78114
6 changed files with 242 additions and 0 deletions
@@ -0,0 +1,51 @@
tests/cases/conformance/types/typeRelationships/matchable/equalityWithIntersectionTypes01.ts(17,5): error TS2365: Operator '===' cannot be applied to types 'I1 & I3' and 'I2'.
tests/cases/conformance/types/typeRelationships/matchable/equalityWithIntersectionTypes01.ts(17,16): error TS2365: Operator '===' cannot be applied to types 'I2' and 'I1 & I3'.
tests/cases/conformance/types/typeRelationships/matchable/equalityWithIntersectionTypes01.ts(19,10): error TS2365: Operator '!==' cannot be applied to types 'I1 & I3' and 'I2'.
tests/cases/conformance/types/typeRelationships/matchable/equalityWithIntersectionTypes01.ts(19,21): error TS2365: Operator '!==' cannot be applied to types 'I2' and 'I1 & I3'.
tests/cases/conformance/types/typeRelationships/matchable/equalityWithIntersectionTypes01.ts(21,10): error TS2365: Operator '==' cannot be applied to types 'I1 & I3' and 'I2'.
tests/cases/conformance/types/typeRelationships/matchable/equalityWithIntersectionTypes01.ts(21,20): error TS2365: Operator '==' cannot be applied to types 'I2' and 'I1 & I3'.
tests/cases/conformance/types/typeRelationships/matchable/equalityWithIntersectionTypes01.ts(23,10): error TS2365: Operator '!=' cannot be applied to types 'I1 & I3' and 'I2'.
tests/cases/conformance/types/typeRelationships/matchable/equalityWithIntersectionTypes01.ts(23,20): error TS2365: Operator '!=' cannot be applied to types 'I2' and 'I1 & I3'.
==== tests/cases/conformance/types/typeRelationships/matchable/equalityWithIntersectionTypes01.ts (8 errors) ====
interface I1 {
p1: number
}
interface I2 extends I1 {
p2: number;
}
interface I3 {
p3: number;
}
var x = { p1: 10, p2: 20, p3: 30 };
var y: I1 & I3 = x;
var z: I2 = x;
if (y === z || z === y) {
~~~~~~~
!!! error TS2365: Operator '===' cannot be applied to types 'I1 & I3' and 'I2'.
~~~~~~~
!!! error TS2365: Operator '===' cannot be applied to types 'I2' and 'I1 & I3'.
}
else if (y !== z || z !== y) {
~~~~~~~
!!! error TS2365: Operator '!==' cannot be applied to types 'I1 & I3' and 'I2'.
~~~~~~~
!!! error TS2365: Operator '!==' cannot be applied to types 'I2' and 'I1 & I3'.
}
else if (y == z || z == y) {
~~~~~~
!!! error TS2365: Operator '==' cannot be applied to types 'I1 & I3' and 'I2'.
~~~~~~
!!! error TS2365: Operator '==' cannot be applied to types 'I2' and 'I1 & I3'.
}
else if (y != z || z != y) {
~~~~~~
!!! error TS2365: Operator '!=' cannot be applied to types 'I1 & I3' and 'I2'.
~~~~~~
!!! error TS2365: Operator '!=' cannot be applied to types 'I2' and 'I1 & I3'.
}
@@ -0,0 +1,38 @@
//// [equalityWithIntersectionTypes01.ts]
interface I1 {
p1: number
}
interface I2 extends I1 {
p2: number;
}
interface I3 {
p3: number;
}
var x = { p1: 10, p2: 20, p3: 30 };
var y: I1 & I3 = x;
var z: I2 = x;
if (y === z || z === y) {
}
else if (y !== z || z !== y) {
}
else if (y == z || z == y) {
}
else if (y != z || z != y) {
}
//// [equalityWithIntersectionTypes01.js]
var x = { p1: 10, p2: 20, p3: 30 };
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/switchCaseWithIntersectionTypes01.ts(19,10): error TS2322: Type 'number & boolean' is not assignable to type 'string & number'.
Type 'number & boolean' is not assignable to type 'string'.
Type 'boolean' is not assignable to type 'string'.
tests/cases/conformance/types/typeRelationships/matchable/switchCaseWithIntersectionTypes01.ts(23,10): error TS2322: Type 'boolean' is not assignable to type 'string & number'.
Type 'boolean' is not assignable to type 'string'.
==== tests/cases/conformance/types/typeRelationships/matchable/switchCaseWithIntersectionTypes01.ts (2 errors) ====
var strAndNum: string & number;
var numAndBool: number & boolean;
var str: string;
var num: number;
var bool: boolean;
switch (strAndNum) {
// Identical
case strAndNum:
break;
// Constituents
case str:
case num:
break;
// Overlap in constituents
case numAndBool:
~~~~~~~~~~
!!! error TS2322: Type 'number & boolean' is not assignable to type 'string & number'.
!!! error TS2322: Type 'number & boolean' is not assignable to type 'string'.
!!! error TS2322: Type 'boolean' is not assignable to type 'string'.
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 'string'.
break;
}
@@ -0,0 +1,48 @@
//// [switchCaseWithIntersectionTypes01.ts]
var strAndNum: string & number;
var numAndBool: number & boolean;
var str: string;
var num: number;
var bool: boolean;
switch (strAndNum) {
// Identical
case strAndNum:
break;
// Constituents
case str:
case num:
break;
// Overlap in constituents
case numAndBool:
break;
// No relation
case bool:
break;
}
//// [switchCaseWithIntersectionTypes01.js]
var strAndNum;
var numAndBool;
var str;
var num;
var bool;
switch (strAndNum) {
// Identical
case strAndNum:
break;
// Constituents
case str:
case num:
break;
// Overlap in constituents
case numAndBool:
break;
// No relation
case bool:
break;
}
@@ -0,0 +1,34 @@
tests/cases/conformance/types/typeRelationships/matchable/typeAssertionsWithIntersectionTypes01.ts(17,9): error TS2352: Neither type 'I2' nor type 'I1 & I3' is assignable to the other.
Type 'I2' is not assignable to type 'I3'.
Property 'p3' is missing in type 'I2'.
tests/cases/conformance/types/typeRelationships/matchable/typeAssertionsWithIntersectionTypes01.ts(18,9): error TS2352: Neither type 'I2' nor type 'I3' is assignable to the other.
==== tests/cases/conformance/types/typeRelationships/matchable/typeAssertionsWithIntersectionTypes01.ts (2 errors) ====
interface I1 {
p1: number
}
interface I2 extends I1 {
p2: number;
}
interface I3 {
p3: number;
}
var x = { p1: 10, p2: 20, p3: 30 };
var y: I1 & I3 = x;
var z: I2 = x;
var a = <I1 & I3>z;
~~~~~~~~~~
!!! error TS2352: Neither type 'I2' nor type 'I1 & I3' is assignable to the other.
!!! error TS2352: Type 'I2' is not assignable to type 'I3'.
!!! error TS2352: Property 'p3' is missing in type 'I2'.
var b = <I3>z;
~~~~~
!!! error TS2352: Neither type 'I2' nor type 'I3' is assignable to the other.
var c = <I2>z;
var d = <I1>y;
@@ -0,0 +1,31 @@
//// [typeAssertionsWithIntersectionTypes01.ts]
interface I1 {
p1: number
}
interface I2 extends I1 {
p2: number;
}
interface I3 {
p3: number;
}
var x = { p1: 10, p2: 20, p3: 30 };
var y: I1 & I3 = x;
var z: I2 = x;
var a = <I1 & I3>z;
var b = <I3>z;
var c = <I2>z;
var d = <I1>y;
//// [typeAssertionsWithIntersectionTypes01.js]
var x = { p1: 10, p2: 20, p3: 30 };
var y = x;
var z = x;
var a = z;
var b = z;
var c = z;
var d = y;