Accepted baselines.

This commit is contained in:
Daniel Rosenwasser 2018-06-20 22:22:30 -07:00
parent 639d9ebb15
commit 9ba2eff4b0
4 changed files with 458 additions and 0 deletions

View file

@ -0,0 +1,99 @@
tests/cases/compiler/unionTypeErrorMessageTypeRefs01.ts(25,1): error TS2322: Type 'A<Foo>' is not assignable to type 'A<Bar> | B<Baz> | C<Kwah>'.
Type 'A<Foo>' is not assignable to type 'C<Kwah>'.
Property 'cProp' is missing in type 'A<Foo>'.
tests/cases/compiler/unionTypeErrorMessageTypeRefs01.ts(26,1): error TS2322: Type 'B<Foo>' is not assignable to type 'A<Bar> | B<Baz> | C<Kwah>'.
Type 'B<Foo>' is not assignable to type 'C<Kwah>'.
Property 'cProp' is missing in type 'B<Foo>'.
tests/cases/compiler/unionTypeErrorMessageTypeRefs01.ts(27,1): error TS2322: Type 'C<Foo>' is not assignable to type 'A<Bar> | B<Baz> | C<Kwah>'.
Type 'C<Foo>' is not assignable to type 'C<Kwah>'.
Type 'Foo' is not assignable to type 'Kwah'.
Property 'kwah' is missing in type 'Foo'.
tests/cases/compiler/unionTypeErrorMessageTypeRefs01.ts(48,1): error TS2322: Type 'X<Foo>' is not assignable to type 'X<Bar> | Y<Baz> | Z<Kwah>'.
Type 'X<Foo>' is not assignable to type 'Z<Kwah>'.
Property 'zProp' is missing in type 'X<Foo>'.
tests/cases/compiler/unionTypeErrorMessageTypeRefs01.ts(49,1): error TS2322: Type 'Y<Foo>' is not assignable to type 'X<Bar> | Y<Baz> | Z<Kwah>'.
Type 'Y<Foo>' is not assignable to type 'Z<Kwah>'.
Property 'zProp' is missing in type 'Y<Foo>'.
tests/cases/compiler/unionTypeErrorMessageTypeRefs01.ts(50,1): error TS2322: Type 'Z<Foo>' is not assignable to type 'X<Bar> | Y<Baz> | Z<Kwah>'.
Type 'Z<Foo>' is not assignable to type 'Z<Kwah>'.
Types of property 'zProp' are incompatible.
Type 'Foo' is not assignable to type 'Kwah'.
==== tests/cases/compiler/unionTypeErrorMessageTypeRefs01.ts (6 errors) ====
interface Foo { foo: any }
interface Bar { bar: any }
interface Baz { baz: any }
interface Kwah { kwah: any }
////////
interface A<T> {
aProp: T;
}
interface B<T> {
bProp: T;
}
interface C<T> {
cProp: T;
}
declare const a: A<Foo>;
declare const b: B<Foo>;
declare const c: C<Foo>;
declare let thingOfInterfaces: A<Bar> | B<Baz> | C<Kwah>;
thingOfInterfaces = a;
~~~~~~~~~~~~~~~~~
!!! error TS2322: Type 'A<Foo>' is not assignable to type 'A<Bar> | B<Baz> | C<Kwah>'.
!!! error TS2322: Type 'A<Foo>' is not assignable to type 'C<Kwah>'.
!!! error TS2322: Property 'cProp' is missing in type 'A<Foo>'.
thingOfInterfaces = b;
~~~~~~~~~~~~~~~~~
!!! error TS2322: Type 'B<Foo>' is not assignable to type 'A<Bar> | B<Baz> | C<Kwah>'.
!!! error TS2322: Type 'B<Foo>' is not assignable to type 'C<Kwah>'.
!!! error TS2322: Property 'cProp' is missing in type 'B<Foo>'.
thingOfInterfaces = c;
~~~~~~~~~~~~~~~~~
!!! error TS2322: Type 'C<Foo>' is not assignable to type 'A<Bar> | B<Baz> | C<Kwah>'.
!!! error TS2322: Type 'C<Foo>' is not assignable to type 'C<Kwah>'.
!!! error TS2322: Type 'Foo' is not assignable to type 'Kwah'.
!!! error TS2322: Property 'kwah' is missing in type 'Foo'.
////////
type X<T> = {
xProp: T;
}
type Y<T> = {
yProp: T;
}
type Z<T> = {
zProp: T;
}
declare const x: X<Foo>;
declare const y: Y<Foo>;
declare const z: Z<Foo>;
declare let thingOfTypeAliases: X<Bar> | Y<Baz> | Z<Kwah>;
thingOfTypeAliases = x;
~~~~~~~~~~~~~~~~~~
!!! error TS2322: Type 'X<Foo>' is not assignable to type 'X<Bar> | Y<Baz> | Z<Kwah>'.
!!! error TS2322: Type 'X<Foo>' is not assignable to type 'Z<Kwah>'.
!!! error TS2322: Property 'zProp' is missing in type 'X<Foo>'.
thingOfTypeAliases = y;
~~~~~~~~~~~~~~~~~~
!!! error TS2322: Type 'Y<Foo>' is not assignable to type 'X<Bar> | Y<Baz> | Z<Kwah>'.
!!! error TS2322: Type 'Y<Foo>' is not assignable to type 'Z<Kwah>'.
!!! error TS2322: Property 'zProp' is missing in type 'Y<Foo>'.
thingOfTypeAliases = z;
~~~~~~~~~~~~~~~~~~
!!! error TS2322: Type 'Z<Foo>' is not assignable to type 'X<Bar> | Y<Baz> | Z<Kwah>'.
!!! error TS2322: Type 'Z<Foo>' is not assignable to type 'Z<Kwah>'.
!!! error TS2322: Types of property 'zProp' are incompatible.
!!! error TS2322: Type 'Foo' is not assignable to type 'Kwah'.

View file

@ -0,0 +1,59 @@
//// [unionTypeErrorMessageTypeRefs01.ts]
interface Foo { foo: any }
interface Bar { bar: any }
interface Baz { baz: any }
interface Kwah { kwah: any }
////////
interface A<T> {
aProp: T;
}
interface B<T> {
bProp: T;
}
interface C<T> {
cProp: T;
}
declare const a: A<Foo>;
declare const b: B<Foo>;
declare const c: C<Foo>;
declare let thingOfInterfaces: A<Bar> | B<Baz> | C<Kwah>;
thingOfInterfaces = a;
thingOfInterfaces = b;
thingOfInterfaces = c;
////////
type X<T> = {
xProp: T;
}
type Y<T> = {
yProp: T;
}
type Z<T> = {
zProp: T;
}
declare const x: X<Foo>;
declare const y: Y<Foo>;
declare const z: Z<Foo>;
declare let thingOfTypeAliases: X<Bar> | Y<Baz> | Z<Kwah>;
thingOfTypeAliases = x;
thingOfTypeAliases = y;
thingOfTypeAliases = z;
//// [unionTypeErrorMessageTypeRefs01.js]
thingOfInterfaces = a;
thingOfInterfaces = b;
thingOfInterfaces = c;
thingOfTypeAliases = x;
thingOfTypeAliases = y;
thingOfTypeAliases = z;

View file

@ -0,0 +1,147 @@
=== tests/cases/compiler/unionTypeErrorMessageTypeRefs01.ts ===
interface Foo { foo: any }
>Foo : Symbol(Foo, Decl(unionTypeErrorMessageTypeRefs01.ts, 0, 0))
>foo : Symbol(Foo.foo, Decl(unionTypeErrorMessageTypeRefs01.ts, 0, 15))
interface Bar { bar: any }
>Bar : Symbol(Bar, Decl(unionTypeErrorMessageTypeRefs01.ts, 0, 26))
>bar : Symbol(Bar.bar, Decl(unionTypeErrorMessageTypeRefs01.ts, 1, 15))
interface Baz { baz: any }
>Baz : Symbol(Baz, Decl(unionTypeErrorMessageTypeRefs01.ts, 1, 26))
>baz : Symbol(Baz.baz, Decl(unionTypeErrorMessageTypeRefs01.ts, 2, 15))
interface Kwah { kwah: any }
>Kwah : Symbol(Kwah, Decl(unionTypeErrorMessageTypeRefs01.ts, 2, 26))
>kwah : Symbol(Kwah.kwah, Decl(unionTypeErrorMessageTypeRefs01.ts, 3, 16))
////////
interface A<T> {
>A : Symbol(A, Decl(unionTypeErrorMessageTypeRefs01.ts, 3, 28))
>T : Symbol(T, Decl(unionTypeErrorMessageTypeRefs01.ts, 7, 12))
aProp: T;
>aProp : Symbol(A.aProp, Decl(unionTypeErrorMessageTypeRefs01.ts, 7, 16))
>T : Symbol(T, Decl(unionTypeErrorMessageTypeRefs01.ts, 7, 12))
}
interface B<T> {
>B : Symbol(B, Decl(unionTypeErrorMessageTypeRefs01.ts, 9, 1))
>T : Symbol(T, Decl(unionTypeErrorMessageTypeRefs01.ts, 11, 12))
bProp: T;
>bProp : Symbol(B.bProp, Decl(unionTypeErrorMessageTypeRefs01.ts, 11, 16))
>T : Symbol(T, Decl(unionTypeErrorMessageTypeRefs01.ts, 11, 12))
}
interface C<T> {
>C : Symbol(C, Decl(unionTypeErrorMessageTypeRefs01.ts, 13, 1))
>T : Symbol(T, Decl(unionTypeErrorMessageTypeRefs01.ts, 15, 12))
cProp: T;
>cProp : Symbol(C.cProp, Decl(unionTypeErrorMessageTypeRefs01.ts, 15, 16))
>T : Symbol(T, Decl(unionTypeErrorMessageTypeRefs01.ts, 15, 12))
}
declare const a: A<Foo>;
>a : Symbol(a, Decl(unionTypeErrorMessageTypeRefs01.ts, 19, 13))
>A : Symbol(A, Decl(unionTypeErrorMessageTypeRefs01.ts, 3, 28))
>Foo : Symbol(Foo, Decl(unionTypeErrorMessageTypeRefs01.ts, 0, 0))
declare const b: B<Foo>;
>b : Symbol(b, Decl(unionTypeErrorMessageTypeRefs01.ts, 20, 13))
>B : Symbol(B, Decl(unionTypeErrorMessageTypeRefs01.ts, 9, 1))
>Foo : Symbol(Foo, Decl(unionTypeErrorMessageTypeRefs01.ts, 0, 0))
declare const c: C<Foo>;
>c : Symbol(c, Decl(unionTypeErrorMessageTypeRefs01.ts, 21, 13))
>C : Symbol(C, Decl(unionTypeErrorMessageTypeRefs01.ts, 13, 1))
>Foo : Symbol(Foo, Decl(unionTypeErrorMessageTypeRefs01.ts, 0, 0))
declare let thingOfInterfaces: A<Bar> | B<Baz> | C<Kwah>;
>thingOfInterfaces : Symbol(thingOfInterfaces, Decl(unionTypeErrorMessageTypeRefs01.ts, 22, 11))
>A : Symbol(A, Decl(unionTypeErrorMessageTypeRefs01.ts, 3, 28))
>Bar : Symbol(Bar, Decl(unionTypeErrorMessageTypeRefs01.ts, 0, 26))
>B : Symbol(B, Decl(unionTypeErrorMessageTypeRefs01.ts, 9, 1))
>Baz : Symbol(Baz, Decl(unionTypeErrorMessageTypeRefs01.ts, 1, 26))
>C : Symbol(C, Decl(unionTypeErrorMessageTypeRefs01.ts, 13, 1))
>Kwah : Symbol(Kwah, Decl(unionTypeErrorMessageTypeRefs01.ts, 2, 26))
thingOfInterfaces = a;
>thingOfInterfaces : Symbol(thingOfInterfaces, Decl(unionTypeErrorMessageTypeRefs01.ts, 22, 11))
>a : Symbol(a, Decl(unionTypeErrorMessageTypeRefs01.ts, 19, 13))
thingOfInterfaces = b;
>thingOfInterfaces : Symbol(thingOfInterfaces, Decl(unionTypeErrorMessageTypeRefs01.ts, 22, 11))
>b : Symbol(b, Decl(unionTypeErrorMessageTypeRefs01.ts, 20, 13))
thingOfInterfaces = c;
>thingOfInterfaces : Symbol(thingOfInterfaces, Decl(unionTypeErrorMessageTypeRefs01.ts, 22, 11))
>c : Symbol(c, Decl(unionTypeErrorMessageTypeRefs01.ts, 21, 13))
////////
type X<T> = {
>X : Symbol(X, Decl(unionTypeErrorMessageTypeRefs01.ts, 26, 22))
>T : Symbol(T, Decl(unionTypeErrorMessageTypeRefs01.ts, 30, 7))
xProp: T;
>xProp : Symbol(xProp, Decl(unionTypeErrorMessageTypeRefs01.ts, 30, 13))
>T : Symbol(T, Decl(unionTypeErrorMessageTypeRefs01.ts, 30, 7))
}
type Y<T> = {
>Y : Symbol(Y, Decl(unionTypeErrorMessageTypeRefs01.ts, 32, 1))
>T : Symbol(T, Decl(unionTypeErrorMessageTypeRefs01.ts, 34, 7))
yProp: T;
>yProp : Symbol(yProp, Decl(unionTypeErrorMessageTypeRefs01.ts, 34, 13))
>T : Symbol(T, Decl(unionTypeErrorMessageTypeRefs01.ts, 34, 7))
}
type Z<T> = {
>Z : Symbol(Z, Decl(unionTypeErrorMessageTypeRefs01.ts, 36, 1))
>T : Symbol(T, Decl(unionTypeErrorMessageTypeRefs01.ts, 38, 7))
zProp: T;
>zProp : Symbol(zProp, Decl(unionTypeErrorMessageTypeRefs01.ts, 38, 13))
>T : Symbol(T, Decl(unionTypeErrorMessageTypeRefs01.ts, 38, 7))
}
declare const x: X<Foo>;
>x : Symbol(x, Decl(unionTypeErrorMessageTypeRefs01.ts, 42, 13))
>X : Symbol(X, Decl(unionTypeErrorMessageTypeRefs01.ts, 26, 22))
>Foo : Symbol(Foo, Decl(unionTypeErrorMessageTypeRefs01.ts, 0, 0))
declare const y: Y<Foo>;
>y : Symbol(y, Decl(unionTypeErrorMessageTypeRefs01.ts, 43, 13))
>Y : Symbol(Y, Decl(unionTypeErrorMessageTypeRefs01.ts, 32, 1))
>Foo : Symbol(Foo, Decl(unionTypeErrorMessageTypeRefs01.ts, 0, 0))
declare const z: Z<Foo>;
>z : Symbol(z, Decl(unionTypeErrorMessageTypeRefs01.ts, 44, 13))
>Z : Symbol(Z, Decl(unionTypeErrorMessageTypeRefs01.ts, 36, 1))
>Foo : Symbol(Foo, Decl(unionTypeErrorMessageTypeRefs01.ts, 0, 0))
declare let thingOfTypeAliases: X<Bar> | Y<Baz> | Z<Kwah>;
>thingOfTypeAliases : Symbol(thingOfTypeAliases, Decl(unionTypeErrorMessageTypeRefs01.ts, 45, 11))
>X : Symbol(X, Decl(unionTypeErrorMessageTypeRefs01.ts, 26, 22))
>Bar : Symbol(Bar, Decl(unionTypeErrorMessageTypeRefs01.ts, 0, 26))
>Y : Symbol(Y, Decl(unionTypeErrorMessageTypeRefs01.ts, 32, 1))
>Baz : Symbol(Baz, Decl(unionTypeErrorMessageTypeRefs01.ts, 1, 26))
>Z : Symbol(Z, Decl(unionTypeErrorMessageTypeRefs01.ts, 36, 1))
>Kwah : Symbol(Kwah, Decl(unionTypeErrorMessageTypeRefs01.ts, 2, 26))
thingOfTypeAliases = x;
>thingOfTypeAliases : Symbol(thingOfTypeAliases, Decl(unionTypeErrorMessageTypeRefs01.ts, 45, 11))
>x : Symbol(x, Decl(unionTypeErrorMessageTypeRefs01.ts, 42, 13))
thingOfTypeAliases = y;
>thingOfTypeAliases : Symbol(thingOfTypeAliases, Decl(unionTypeErrorMessageTypeRefs01.ts, 45, 11))
>y : Symbol(y, Decl(unionTypeErrorMessageTypeRefs01.ts, 43, 13))
thingOfTypeAliases = z;
>thingOfTypeAliases : Symbol(thingOfTypeAliases, Decl(unionTypeErrorMessageTypeRefs01.ts, 45, 11))
>z : Symbol(z, Decl(unionTypeErrorMessageTypeRefs01.ts, 44, 13))

View file

@ -0,0 +1,153 @@
=== tests/cases/compiler/unionTypeErrorMessageTypeRefs01.ts ===
interface Foo { foo: any }
>Foo : Foo
>foo : any
interface Bar { bar: any }
>Bar : Bar
>bar : any
interface Baz { baz: any }
>Baz : Baz
>baz : any
interface Kwah { kwah: any }
>Kwah : Kwah
>kwah : any
////////
interface A<T> {
>A : A<T>
>T : T
aProp: T;
>aProp : T
>T : T
}
interface B<T> {
>B : B<T>
>T : T
bProp: T;
>bProp : T
>T : T
}
interface C<T> {
>C : C<T>
>T : T
cProp: T;
>cProp : T
>T : T
}
declare const a: A<Foo>;
>a : A<Foo>
>A : A<T>
>Foo : Foo
declare const b: B<Foo>;
>b : B<Foo>
>B : B<T>
>Foo : Foo
declare const c: C<Foo>;
>c : C<Foo>
>C : C<T>
>Foo : Foo
declare let thingOfInterfaces: A<Bar> | B<Baz> | C<Kwah>;
>thingOfInterfaces : A<Bar> | B<Baz> | C<Kwah>
>A : A<T>
>Bar : Bar
>B : B<T>
>Baz : Baz
>C : C<T>
>Kwah : Kwah
thingOfInterfaces = a;
>thingOfInterfaces = a : A<Foo>
>thingOfInterfaces : A<Bar> | B<Baz> | C<Kwah>
>a : A<Foo>
thingOfInterfaces = b;
>thingOfInterfaces = b : B<Foo>
>thingOfInterfaces : A<Bar> | B<Baz> | C<Kwah>
>b : B<Foo>
thingOfInterfaces = c;
>thingOfInterfaces = c : C<Foo>
>thingOfInterfaces : A<Bar> | B<Baz> | C<Kwah>
>c : C<Foo>
////////
type X<T> = {
>X : X<T>
>T : T
xProp: T;
>xProp : T
>T : T
}
type Y<T> = {
>Y : Y<T>
>T : T
yProp: T;
>yProp : T
>T : T
}
type Z<T> = {
>Z : Z<T>
>T : T
zProp: T;
>zProp : T
>T : T
}
declare const x: X<Foo>;
>x : X<Foo>
>X : X<T>
>Foo : Foo
declare const y: Y<Foo>;
>y : Y<Foo>
>Y : Y<T>
>Foo : Foo
declare const z: Z<Foo>;
>z : Z<Foo>
>Z : Z<T>
>Foo : Foo
declare let thingOfTypeAliases: X<Bar> | Y<Baz> | Z<Kwah>;
>thingOfTypeAliases : X<Bar> | Y<Baz> | Z<Kwah>
>X : X<T>
>Bar : Bar
>Y : Y<T>
>Baz : Baz
>Z : Z<T>
>Kwah : Kwah
thingOfTypeAliases = x;
>thingOfTypeAliases = x : X<Foo>
>thingOfTypeAliases : X<Bar> | Y<Baz> | Z<Kwah>
>x : X<Foo>
thingOfTypeAliases = y;
>thingOfTypeAliases = y : Y<Foo>
>thingOfTypeAliases : X<Bar> | Y<Baz> | Z<Kwah>
>y : Y<Foo>
thingOfTypeAliases = z;
>thingOfTypeAliases = z : Z<Foo>
>thingOfTypeAliases : X<Bar> | Y<Baz> | Z<Kwah>
>z : Z<Foo>