Accepted baselines.

This commit is contained in:
Daniel Rosenwasser
2018-09-13 17:54:06 -07:00
parent 76e721f389
commit 91af958e10
8 changed files with 298 additions and 30 deletions
@@ -9,13 +9,15 @@ tests/cases/conformance/types/union/contextualTypeWithUnionTypeObjectLiteral.ts(
Type 'string | number' is not assignable to type 'number'.
Type 'string' is not assignable to type 'number'.
tests/cases/conformance/types/union/contextualTypeWithUnionTypeObjectLiteral.ts(21,5): error TS2322: Type '{ prop: string | number; anotherP: string; }' is not assignable to type '{ prop: string; anotherP: string; } | { prop: number; }'.
Type '{ prop: string | number; anotherP: string; }' is not assignable to type '{ prop: number; }'.
Type '{ prop: string | number; anotherP: string; }' is not assignable to type '{ prop: string; anotherP: string; }'.
Types of property 'prop' are incompatible.
Type 'string | number' is not assignable to type 'number'.
Type 'string' is not assignable to type 'number'.
Type 'string | number' is not assignable to type 'string'.
Type 'number' is not assignable to type 'string'.
tests/cases/conformance/types/union/contextualTypeWithUnionTypeObjectLiteral.ts(25,5): error TS2322: Type '{ prop: string | number; anotherP: string; }' is not assignable to type '{ prop: string; anotherP: string; } | { prop: number; anotherP1: number; }'.
Type '{ prop: string | number; anotherP: string; }' is not assignable to type '{ prop: number; anotherP1: number; }'.
Property 'anotherP1' is missing in type '{ prop: string | number; anotherP: string; }'.
Type '{ prop: string | number; anotherP: string; }' is not assignable to type '{ prop: string; anotherP: string; }'.
Types of property 'prop' are incompatible.
Type 'string | number' is not assignable to type 'string'.
Type 'number' is not assignable to type 'string'.
tests/cases/conformance/types/union/contextualTypeWithUnionTypeObjectLiteral.ts(29,5): error TS2322: Type '{ prop: string | number; anotherP: string; anotherP1: number; }' is not assignable to type '{ prop: string; anotherP: string; } | { prop: number; anotherP1: number; }'.
Type '{ prop: string | number; anotherP: string; anotherP1: number; }' is not assignable to type '{ prop: number; anotherP1: number; }'.
Types of property 'prop' are incompatible.
@@ -63,18 +65,20 @@ tests/cases/conformance/types/union/contextualTypeWithUnionTypeObjectLiteral.ts(
var objStrOrNum6: { prop: string; anotherP: string; } | { prop: number } = {
~~~~~~~~~~~~
!!! error TS2322: Type '{ prop: string | number; anotherP: string; }' is not assignable to type '{ prop: string; anotherP: string; } | { prop: number; }'.
!!! error TS2322: Type '{ prop: string | number; anotherP: string; }' is not assignable to type '{ prop: number; }'.
!!! error TS2322: Type '{ prop: string | number; anotherP: string; }' is not assignable to type '{ prop: string; anotherP: string; }'.
!!! error TS2322: Types of property 'prop' are incompatible.
!!! error TS2322: Type 'string | number' is not assignable to type 'number'.
!!! error TS2322: Type 'string' is not assignable to type 'number'.
!!! error TS2322: Type 'string | number' is not assignable to type 'string'.
!!! error TS2322: Type 'number' is not assignable to type 'string'.
prop: strOrNumber,
anotherP: str
};
var objStrOrNum7: { prop: string; anotherP: string; } | { prop: number; anotherP1: number } = {
~~~~~~~~~~~~
!!! error TS2322: Type '{ prop: string | number; anotherP: string; }' is not assignable to type '{ prop: string; anotherP: string; } | { prop: number; anotherP1: number; }'.
!!! error TS2322: Type '{ prop: string | number; anotherP: string; }' is not assignable to type '{ prop: number; anotherP1: number; }'.
!!! error TS2322: Property 'anotherP1' is missing in type '{ prop: string | number; anotherP: string; }'.
!!! error TS2322: Type '{ prop: string | number; anotherP: string; }' is not assignable to type '{ prop: string; anotherP: string; }'.
!!! error TS2322: Types of property 'prop' are incompatible.
!!! error TS2322: Type 'string | number' is not assignable to type 'string'.
!!! error TS2322: Type 'number' is not assignable to type 'string'.
prop: strOrNumber,
anotherP: str
};
@@ -0,0 +1,56 @@
tests/cases/compiler/errorsOnUnionsOfOverlappingObjects01.ts(18,3): error TS2345: Argument of type '{ a: string; b: string; }' is not assignable to parameter of type 'Foo | Other'.
Type '{ a: string; b: string; }' is not assignable to type 'Foo'.
Types of property 'b' are incompatible.
Type 'string' is not assignable to type 'number'.
tests/cases/compiler/errorsOnUnionsOfOverlappingObjects01.ts(19,3): error TS2345: Argument of type '{ a: string; b: string; }' is not assignable to parameter of type 'Foo | Other'.
Type '{ a: string; b: string; }' is not assignable to type 'Foo'.
Types of property 'b' are incompatible.
Type 'string' is not assignable to type 'number'.
tests/cases/compiler/errorsOnUnionsOfOverlappingObjects01.ts(24,5): error TS2345: Argument of type '{ a: string; b: string; }' is not assignable to parameter of type 'Bar | Other'.
Object literal may only specify known properties, and 'a' does not exist in type 'Bar | Other'.
==== tests/cases/compiler/errorsOnUnionsOfOverlappingObjects01.ts (3 errors) ====
interface Foo {
a: string;
b: number;
};
interface Bar {
b: string;
}
interface Other {
totallyUnrelatedProperty: number;
}
export let x = { a: '', b: '' };
declare function f(x: Foo | Other): any;
f(x);
~
!!! error TS2345: Argument of type '{ a: string; b: string; }' is not assignable to parameter of type 'Foo | Other'.
!!! error TS2345: Type '{ a: string; b: string; }' is not assignable to type 'Foo'.
!!! error TS2345: Types of property 'b' are incompatible.
!!! error TS2345: Type 'string' is not assignable to type 'number'.
f({ a: '', b: '' })
~~~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '{ a: string; b: string; }' is not assignable to parameter of type 'Foo | Other'.
!!! error TS2345: Type '{ a: string; b: string; }' is not assignable to type 'Foo'.
!!! error TS2345: Types of property 'b' are incompatible.
!!! error TS2345: Type 'string' is not assignable to type 'number'.
declare function g(x: Bar | Other): any;
g(x);
g({ a: '', b: '' })
~~~~~
!!! error TS2345: Argument of type '{ a: string; b: string; }' is not assignable to parameter of type 'Bar | Other'.
!!! error TS2345: Object literal may only specify known properties, and 'a' does not exist in type 'Bar | Other'.
declare function h(x: Foo | Bar | Other): any;
h(x);
h({ a: '', b: '' })
@@ -0,0 +1,43 @@
//// [errorsOnUnionsOfOverlappingObjects01.ts]
interface Foo {
a: string;
b: number;
};
interface Bar {
b: string;
}
interface Other {
totallyUnrelatedProperty: number;
}
export let x = { a: '', b: '' };
declare function f(x: Foo | Other): any;
f(x);
f({ a: '', b: '' })
declare function g(x: Bar | Other): any;
g(x);
g({ a: '', b: '' })
declare function h(x: Foo | Bar | Other): any;
h(x);
h({ a: '', b: '' })
//// [errorsOnUnionsOfOverlappingObjects01.js]
"use strict";
exports.__esModule = true;
;
exports.x = { a: '', b: '' };
f(exports.x);
f({ a: '', b: '' });
g(exports.x);
g({ a: '', b: '' });
h(exports.x);
h({ a: '', b: '' });
@@ -0,0 +1,77 @@
=== tests/cases/compiler/errorsOnUnionsOfOverlappingObjects01.ts ===
interface Foo {
>Foo : Symbol(Foo, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 0, 0))
a: string;
>a : Symbol(Foo.a, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 0, 15))
b: number;
>b : Symbol(Foo.b, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 1, 14))
};
interface Bar {
>Bar : Symbol(Bar, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 3, 2))
b: string;
>b : Symbol(Bar.b, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 5, 15))
}
interface Other {
>Other : Symbol(Other, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 7, 1))
totallyUnrelatedProperty: number;
>totallyUnrelatedProperty : Symbol(Other.totallyUnrelatedProperty, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 9, 17))
}
export let x = { a: '', b: '' };
>x : Symbol(x, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 13, 10))
>a : Symbol(a, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 13, 16))
>b : Symbol(b, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 13, 23))
declare function f(x: Foo | Other): any;
>f : Symbol(f, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 13, 32))
>x : Symbol(x, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 15, 19))
>Foo : Symbol(Foo, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 0, 0))
>Other : Symbol(Other, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 7, 1))
f(x);
>f : Symbol(f, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 13, 32))
>x : Symbol(x, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 13, 10))
f({ a: '', b: '' })
>f : Symbol(f, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 13, 32))
>a : Symbol(a, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 18, 3))
>b : Symbol(b, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 18, 10))
declare function g(x: Bar | Other): any;
>g : Symbol(g, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 18, 19))
>x : Symbol(x, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 20, 19))
>Bar : Symbol(Bar, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 3, 2))
>Other : Symbol(Other, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 7, 1))
g(x);
>g : Symbol(g, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 18, 19))
>x : Symbol(x, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 13, 10))
g({ a: '', b: '' })
>g : Symbol(g, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 18, 19))
>a : Symbol(a, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 23, 3))
>b : Symbol(b, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 23, 10))
declare function h(x: Foo | Bar | Other): any;
>h : Symbol(h, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 23, 19))
>x : Symbol(x, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 25, 19))
>Foo : Symbol(Foo, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 0, 0))
>Bar : Symbol(Bar, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 3, 2))
>Other : Symbol(Other, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 7, 1))
h(x);
>h : Symbol(h, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 23, 19))
>x : Symbol(x, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 13, 10))
h({ a: '', b: '' })
>h : Symbol(h, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 23, 19))
>a : Symbol(a, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 28, 3))
>b : Symbol(b, Decl(errorsOnUnionsOfOverlappingObjects01.ts, 28, 10))
@@ -0,0 +1,82 @@
=== tests/cases/compiler/errorsOnUnionsOfOverlappingObjects01.ts ===
interface Foo {
a: string;
>a : string
b: number;
>b : number
};
interface Bar {
b: string;
>b : string
}
interface Other {
totallyUnrelatedProperty: number;
>totallyUnrelatedProperty : number
}
export let x = { a: '', b: '' };
>x : { a: string; b: string; }
>{ a: '', b: '' } : { a: string; b: string; }
>a : string
>'' : ""
>b : string
>'' : ""
declare function f(x: Foo | Other): any;
>f : (x: Foo | Other) => any
>x : Foo | Other
f(x);
>f(x) : any
>f : (x: Foo | Other) => any
>x : { a: string; b: string; }
f({ a: '', b: '' })
>f({ a: '', b: '' }) : any
>f : (x: Foo | Other) => any
>{ a: '', b: '' } : { a: string; b: string; }
>a : string
>'' : ""
>b : string
>'' : ""
declare function g(x: Bar | Other): any;
>g : (x: Bar | Other) => any
>x : Bar | Other
g(x);
>g(x) : any
>g : (x: Bar | Other) => any
>x : { a: string; b: string; }
g({ a: '', b: '' })
>g({ a: '', b: '' }) : any
>g : (x: Bar | Other) => any
>{ a: '', b: '' } : { a: string; b: string; }
>a : string
>'' : ""
>b : string
>'' : ""
declare function h(x: Foo | Bar | Other): any;
>h : (x: Foo | Bar | Other) => any
>x : Foo | Bar | Other
h(x);
>h(x) : any
>h : (x: Foo | Bar | Other) => any
>x : { a: string; b: string; }
h({ a: '', b: '' })
>h({ a: '', b: '' }) : any
>h : (x: Foo | Bar | Other) => any
>{ a: '', b: '' } : { a: string; b: string; }
>a : string
>'' : ""
>b : string
>'' : ""
@@ -14,9 +14,9 @@ tests/cases/compiler/excessPropertyCheckWithUnions.ts(39,1): error TS2322: Type
Types of property 'tag' are incompatible.
Type '"A"' is not assignable to type '"C"'.
tests/cases/compiler/excessPropertyCheckWithUnions.ts(40,1): error TS2322: Type '{ tag: "A"; z: true; }' is not assignable to type 'Ambiguous'.
Type '{ tag: "A"; z: true; }' is not assignable to type '{ tag: "C"; }'.
Type '{ tag: "A"; z: true; }' is not assignable to type '{ tag: "B"; z: boolean; }'.
Types of property 'tag' are incompatible.
Type '"A"' is not assignable to type '"C"'.
Type '"A"' is not assignable to type '"B"'.
tests/cases/compiler/excessPropertyCheckWithUnions.ts(49,35): error TS2322: Type '{ a: 1; b: 1; first: string; second: string; }' is not assignable to type 'Overlapping'.
Object literal may only specify known properties, and 'second' does not exist in type '{ a: 1; b: 1; first: string; }'.
tests/cases/compiler/excessPropertyCheckWithUnions.ts(50,35): error TS2322: Type '{ a: 1; b: 1; first: string; third: string; }' is not assignable to type 'Overlapping'.
@@ -92,9 +92,9 @@ tests/cases/compiler/excessPropertyCheckWithUnions.ts(66,9): error TS2322: Type
amb = { tag: "A", z: true }
~~~
!!! error TS2322: Type '{ tag: "A"; z: true; }' is not assignable to type 'Ambiguous'.
!!! error TS2322: Type '{ tag: "A"; z: true; }' is not assignable to type '{ tag: "C"; }'.
!!! error TS2322: Type '{ tag: "A"; z: true; }' is not assignable to type '{ tag: "B"; z: boolean; }'.
!!! error TS2322: Types of property 'tag' are incompatible.
!!! error TS2322: Type '"A"' is not assignable to type '"C"'.
!!! error TS2322: Type '"A"' is not assignable to type '"B"'.
type Overlapping =
| { a: 1, b: 1, first: string }
@@ -6,9 +6,8 @@ tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(20,1): e
Property 'a' is missing in type 'B'.
tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(23,1): error TS2322: Type 'A | B' is not assignable to type '(A & B) | (C & D)'.
Type 'A' is not assignable to type '(A & B) | (C & D)'.
Type 'A' is not assignable to type 'C & D'.
Type 'A' is not assignable to type 'C'.
Property 'c' is missing in type 'A'.
Type 'A' is not assignable to type 'A & B'.
Type 'A' is not assignable to type 'B'.
tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(25,1): error TS2322: Type 'C | D' is not assignable to type '(A & B) | (C & D)'.
Type 'C' is not assignable to type '(A & B) | (C & D)'.
Type 'C' is not assignable to type 'C & D'.
@@ -35,14 +34,15 @@ tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(31,1): e
Type 'A & B' is not assignable to type 'D'.
tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(32,1): error TS2322: Type 'A | B' is not assignable to type '(A & C) | (A & D) | (B & C) | (B & D)'.
Type 'A' is not assignable to type '(A & C) | (A & D) | (B & C) | (B & D)'.
Type 'A' is not assignable to type 'B & D'.
Type 'A' is not assignable to type 'B'.
Type 'A' is not assignable to type 'A & D'.
Type 'A' is not assignable to type 'D'.
Property 'd' is missing in type 'A'.
tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(33,1): error TS2322: Type 'C & D' is not assignable to type '(A & C) | (A & D) | (B & C) | (B & D)'.
Type 'C & D' is not assignable to type 'B & D'.
Type 'C & D' is not assignable to type 'B'.
tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(34,1): error TS2322: Type 'C | D' is not assignable to type '(A & C) | (A & D) | (B & C) | (B & D)'.
Type 'C' is not assignable to type '(A & C) | (A & D) | (B & C) | (B & D)'.
Type 'C' is not assignable to type 'B & D'.
Type 'C' is not assignable to type 'B & C'.
Type 'C' is not assignable to type 'B'.
Property 'b' is missing in type 'C'.
tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(35,1): error TS2322: Type '(A & C) | (A & D) | (B & C) | (B & D)' is not assignable to type 'A & B'.
@@ -90,9 +90,8 @@ tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(37,1): e
~
!!! error TS2322: Type 'A | B' is not assignable to type '(A & B) | (C & D)'.
!!! error TS2322: Type 'A' is not assignable to type '(A & B) | (C & D)'.
!!! error TS2322: Type 'A' is not assignable to type 'C & D'.
!!! error TS2322: Type 'A' is not assignable to type 'C'.
!!! error TS2322: Property 'c' is missing in type 'A'.
!!! error TS2322: Type 'A' is not assignable to type 'A & B'.
!!! error TS2322: Type 'A' is not assignable to type 'B'.
x = cnd; // Ok
x = cod;
~
@@ -135,8 +134,9 @@ tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(37,1): e
~
!!! error TS2322: Type 'A | B' is not assignable to type '(A & C) | (A & D) | (B & C) | (B & D)'.
!!! error TS2322: Type 'A' is not assignable to type '(A & C) | (A & D) | (B & C) | (B & D)'.
!!! error TS2322: Type 'A' is not assignable to type 'B & D'.
!!! error TS2322: Type 'A' is not assignable to type 'B'.
!!! error TS2322: Type 'A' is not assignable to type 'A & D'.
!!! error TS2322: Type 'A' is not assignable to type 'D'.
!!! error TS2322: Property 'd' is missing in type 'A'.
y = cnd;
~
!!! error TS2322: Type 'C & D' is not assignable to type '(A & C) | (A & D) | (B & C) | (B & D)'.
@@ -146,7 +146,7 @@ tests/cases/conformance/types/intersection/intersectionAndUnionTypes.ts(37,1): e
~
!!! error TS2322: Type 'C | D' is not assignable to type '(A & C) | (A & D) | (B & C) | (B & D)'.
!!! error TS2322: Type 'C' is not assignable to type '(A & C) | (A & D) | (B & C) | (B & D)'.
!!! error TS2322: Type 'C' is not assignable to type 'B & D'.
!!! error TS2322: Type 'C' is not assignable to type 'B & C'.
!!! error TS2322: Type 'C' is not assignable to type 'B'.
!!! error TS2322: Property 'b' is missing in type 'C'.
anb = y;
@@ -6,8 +6,11 @@ tests/cases/compiler/unionTypeWithRecursiveSubtypeReduction2.ts(19,1): error TS2
tests/cases/compiler/unionTypeWithRecursiveSubtypeReduction2.ts(20,1): error TS2322: Type 'Class' is not assignable to type 'Property'.
Types of property 'parent' are incompatible.
Type 'Namespace' is not assignable to type 'Module | Class'.
Type 'Namespace' is not assignable to type 'Class'.
Property 'parent' is missing in type 'Namespace'.
Type 'Namespace' is not assignable to type 'Module'.
Types of property 'members' are incompatible.
Type '(Class | Property)[]' is not assignable to type 'Class[]'.
Type 'Class | Property' is not assignable to type 'Class'.
Type 'Property' is not assignable to type 'Class'.
==== tests/cases/compiler/unionTypeWithRecursiveSubtypeReduction2.ts (2 errors) ====
@@ -41,6 +44,9 @@ tests/cases/compiler/unionTypeWithRecursiveSubtypeReduction2.ts(20,1): error TS2
!!! error TS2322: Type 'Class' is not assignable to type 'Property'.
!!! error TS2322: Types of property 'parent' are incompatible.
!!! error TS2322: Type 'Namespace' is not assignable to type 'Module | Class'.
!!! error TS2322: Type 'Namespace' is not assignable to type 'Class'.
!!! error TS2322: Property 'parent' is missing in type 'Namespace'.
!!! error TS2322: Type 'Namespace' is not assignable to type 'Module'.
!!! error TS2322: Types of property 'members' are incompatible.
!!! error TS2322: Type '(Class | Property)[]' is not assignable to type 'Class[]'.
!!! error TS2322: Type 'Class | Property' is not assignable to type 'Class'.
!!! error TS2322: Type 'Property' is not assignable to type 'Class'.