417 lines
19 KiB
Text
417 lines
19 KiB
Text
=== tests/cases/conformance/types/typeRelationships/bestCommonType/heterogeneousArrayLiterals.ts ===
|
|
// type of an array is the best common type of its elements (plus its contextual type if it exists)
|
|
|
|
var a = [1, '']; // {}[]
|
|
>a : Symbol(a, Decl(heterogeneousArrayLiterals.ts, 2, 3))
|
|
|
|
var b = [1, null]; // number[]
|
|
>b : Symbol(b, Decl(heterogeneousArrayLiterals.ts, 3, 3))
|
|
|
|
var c = [1, '', null]; // {}[]
|
|
>c : Symbol(c, Decl(heterogeneousArrayLiterals.ts, 4, 3))
|
|
|
|
var d = [{}, 1]; // {}[]
|
|
>d : Symbol(d, Decl(heterogeneousArrayLiterals.ts, 5, 3))
|
|
|
|
var e = [{}, Object]; // {}[]
|
|
>e : Symbol(e, Decl(heterogeneousArrayLiterals.ts, 6, 3))
|
|
>Object : Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11))
|
|
|
|
var f = [[], [1]]; // number[][]
|
|
>f : Symbol(f, Decl(heterogeneousArrayLiterals.ts, 8, 3))
|
|
|
|
var g = [[1], ['']]; // {}[]
|
|
>g : Symbol(g, Decl(heterogeneousArrayLiterals.ts, 9, 3))
|
|
|
|
var h = [{ foo: 1, bar: '' }, { foo: 2 }]; // {foo: number}[]
|
|
>h : Symbol(h, Decl(heterogeneousArrayLiterals.ts, 11, 3))
|
|
>foo : Symbol(foo, Decl(heterogeneousArrayLiterals.ts, 11, 10))
|
|
>bar : Symbol(bar, Decl(heterogeneousArrayLiterals.ts, 11, 18))
|
|
>foo : Symbol(foo, Decl(heterogeneousArrayLiterals.ts, 11, 31))
|
|
|
|
var i = [{ foo: 1, bar: '' }, { foo: '' }]; // {}[]
|
|
>i : Symbol(i, Decl(heterogeneousArrayLiterals.ts, 12, 3))
|
|
>foo : Symbol(foo, Decl(heterogeneousArrayLiterals.ts, 12, 10))
|
|
>bar : Symbol(bar, Decl(heterogeneousArrayLiterals.ts, 12, 18))
|
|
>foo : Symbol(foo, Decl(heterogeneousArrayLiterals.ts, 12, 31))
|
|
|
|
var j = [() => 1, () => '']; // {}[]
|
|
>j : Symbol(j, Decl(heterogeneousArrayLiterals.ts, 14, 3))
|
|
|
|
var k = [() => 1, () => 1]; // { (): number }[]
|
|
>k : Symbol(k, Decl(heterogeneousArrayLiterals.ts, 15, 3))
|
|
|
|
var l = [() => 1, () => null]; // { (): any }[]
|
|
>l : Symbol(l, Decl(heterogeneousArrayLiterals.ts, 16, 3))
|
|
|
|
var m = [() => 1, () => '', () => null]; // { (): any }[]
|
|
>m : Symbol(m, Decl(heterogeneousArrayLiterals.ts, 17, 3))
|
|
|
|
var n = [[() => 1], [() => '']]; // {}[]
|
|
>n : Symbol(n, Decl(heterogeneousArrayLiterals.ts, 18, 3))
|
|
|
|
class Base { foo: string; }
|
|
>Base : Symbol(Base, Decl(heterogeneousArrayLiterals.ts, 18, 32))
|
|
>foo : Symbol(foo, Decl(heterogeneousArrayLiterals.ts, 20, 12))
|
|
|
|
class Derived extends Base { bar: string; }
|
|
>Derived : Symbol(Derived, Decl(heterogeneousArrayLiterals.ts, 20, 27), Decl(heterogeneousArrayLiterals.ts, 25, 23))
|
|
>Base : Symbol(Base, Decl(heterogeneousArrayLiterals.ts, 18, 32))
|
|
>bar : Symbol(bar, Decl(heterogeneousArrayLiterals.ts, 21, 28))
|
|
|
|
class Derived2 extends Base { baz: string; }
|
|
>Derived2 : Symbol(Derived2, Decl(heterogeneousArrayLiterals.ts, 21, 43))
|
|
>Base : Symbol(Base, Decl(heterogeneousArrayLiterals.ts, 18, 32))
|
|
>baz : Symbol(baz, Decl(heterogeneousArrayLiterals.ts, 22, 29))
|
|
|
|
var base: Base;
|
|
>base : Symbol(base, Decl(heterogeneousArrayLiterals.ts, 23, 3))
|
|
>Base : Symbol(Base, Decl(heterogeneousArrayLiterals.ts, 18, 32))
|
|
|
|
var derived: Derived;
|
|
>derived : Symbol(derived, Decl(heterogeneousArrayLiterals.ts, 24, 3))
|
|
>Derived : Symbol(Derived, Decl(heterogeneousArrayLiterals.ts, 20, 27), Decl(heterogeneousArrayLiterals.ts, 25, 23))
|
|
|
|
var derived2: Derived2;
|
|
>derived2 : Symbol(derived2, Decl(heterogeneousArrayLiterals.ts, 25, 3))
|
|
>Derived2 : Symbol(Derived2, Decl(heterogeneousArrayLiterals.ts, 21, 43))
|
|
|
|
module Derived {
|
|
>Derived : Symbol(Derived, Decl(heterogeneousArrayLiterals.ts, 20, 27), Decl(heterogeneousArrayLiterals.ts, 25, 23))
|
|
|
|
var h = [{ foo: base, basear: derived }, { foo: base }]; // {foo: Base}[]
|
|
>h : Symbol(h, Decl(heterogeneousArrayLiterals.ts, 28, 7))
|
|
>foo : Symbol(foo, Decl(heterogeneousArrayLiterals.ts, 28, 14))
|
|
>base : Symbol(base, Decl(heterogeneousArrayLiterals.ts, 23, 3))
|
|
>basear : Symbol(basear, Decl(heterogeneousArrayLiterals.ts, 28, 25))
|
|
>derived : Symbol(derived, Decl(heterogeneousArrayLiterals.ts, 24, 3))
|
|
>foo : Symbol(foo, Decl(heterogeneousArrayLiterals.ts, 28, 46))
|
|
>base : Symbol(base, Decl(heterogeneousArrayLiterals.ts, 23, 3))
|
|
|
|
var i = [{ foo: base, basear: derived }, { foo: derived }]; // {foo: Derived}[]
|
|
>i : Symbol(i, Decl(heterogeneousArrayLiterals.ts, 29, 7))
|
|
>foo : Symbol(foo, Decl(heterogeneousArrayLiterals.ts, 29, 14))
|
|
>base : Symbol(base, Decl(heterogeneousArrayLiterals.ts, 23, 3))
|
|
>basear : Symbol(basear, Decl(heterogeneousArrayLiterals.ts, 29, 25))
|
|
>derived : Symbol(derived, Decl(heterogeneousArrayLiterals.ts, 24, 3))
|
|
>foo : Symbol(foo, Decl(heterogeneousArrayLiterals.ts, 29, 46))
|
|
>derived : Symbol(derived, Decl(heterogeneousArrayLiterals.ts, 24, 3))
|
|
|
|
var j = [() => base, () => derived]; // { {}: Base }
|
|
>j : Symbol(j, Decl(heterogeneousArrayLiterals.ts, 31, 7))
|
|
>base : Symbol(base, Decl(heterogeneousArrayLiterals.ts, 23, 3))
|
|
>derived : Symbol(derived, Decl(heterogeneousArrayLiterals.ts, 24, 3))
|
|
|
|
var k = [() => base, () => 1]; // {}[]~
|
|
>k : Symbol(k, Decl(heterogeneousArrayLiterals.ts, 32, 7))
|
|
>base : Symbol(base, Decl(heterogeneousArrayLiterals.ts, 23, 3))
|
|
|
|
var l = [() => base, () => null]; // { (): any }[]
|
|
>l : Symbol(l, Decl(heterogeneousArrayLiterals.ts, 33, 7))
|
|
>base : Symbol(base, Decl(heterogeneousArrayLiterals.ts, 23, 3))
|
|
|
|
var m = [() => base, () => derived, () => null]; // { (): any }[]
|
|
>m : Symbol(m, Decl(heterogeneousArrayLiterals.ts, 34, 7))
|
|
>base : Symbol(base, Decl(heterogeneousArrayLiterals.ts, 23, 3))
|
|
>derived : Symbol(derived, Decl(heterogeneousArrayLiterals.ts, 24, 3))
|
|
|
|
var n = [[() => base], [() => derived]]; // { (): Base }[]
|
|
>n : Symbol(n, Decl(heterogeneousArrayLiterals.ts, 35, 7))
|
|
>base : Symbol(base, Decl(heterogeneousArrayLiterals.ts, 23, 3))
|
|
>derived : Symbol(derived, Decl(heterogeneousArrayLiterals.ts, 24, 3))
|
|
|
|
var o = [derived, derived2]; // {}[]
|
|
>o : Symbol(o, Decl(heterogeneousArrayLiterals.ts, 36, 7))
|
|
>derived : Symbol(derived, Decl(heterogeneousArrayLiterals.ts, 24, 3))
|
|
>derived2 : Symbol(derived2, Decl(heterogeneousArrayLiterals.ts, 25, 3))
|
|
|
|
var p = [derived, derived2, base]; // Base[]
|
|
>p : Symbol(p, Decl(heterogeneousArrayLiterals.ts, 37, 7))
|
|
>derived : Symbol(derived, Decl(heterogeneousArrayLiterals.ts, 24, 3))
|
|
>derived2 : Symbol(derived2, Decl(heterogeneousArrayLiterals.ts, 25, 3))
|
|
>base : Symbol(base, Decl(heterogeneousArrayLiterals.ts, 23, 3))
|
|
|
|
var q = [[() => derived2], [() => derived]]; // {}[]
|
|
>q : Symbol(q, Decl(heterogeneousArrayLiterals.ts, 38, 7))
|
|
>derived2 : Symbol(derived2, Decl(heterogeneousArrayLiterals.ts, 25, 3))
|
|
>derived : Symbol(derived, Decl(heterogeneousArrayLiterals.ts, 24, 3))
|
|
}
|
|
|
|
module WithContextualType {
|
|
>WithContextualType : Symbol(WithContextualType, Decl(heterogeneousArrayLiterals.ts, 39, 1))
|
|
|
|
// no errors
|
|
var a: Base[] = [derived, derived2];
|
|
>a : Symbol(a, Decl(heterogeneousArrayLiterals.ts, 43, 7))
|
|
>Base : Symbol(Base, Decl(heterogeneousArrayLiterals.ts, 18, 32))
|
|
>derived : Symbol(derived, Decl(heterogeneousArrayLiterals.ts, 24, 3))
|
|
>derived2 : Symbol(derived2, Decl(heterogeneousArrayLiterals.ts, 25, 3))
|
|
|
|
var b: Derived[] = [null];
|
|
>b : Symbol(b, Decl(heterogeneousArrayLiterals.ts, 44, 7))
|
|
>Derived : Symbol(Derived, Decl(heterogeneousArrayLiterals.ts, 20, 27), Decl(heterogeneousArrayLiterals.ts, 25, 23))
|
|
|
|
var c: Derived[] = [];
|
|
>c : Symbol(c, Decl(heterogeneousArrayLiterals.ts, 45, 7))
|
|
>Derived : Symbol(Derived, Decl(heterogeneousArrayLiterals.ts, 20, 27), Decl(heterogeneousArrayLiterals.ts, 25, 23))
|
|
|
|
var d: { (): Base }[] = [() => derived, () => derived2];
|
|
>d : Symbol(d, Decl(heterogeneousArrayLiterals.ts, 46, 7))
|
|
>Base : Symbol(Base, Decl(heterogeneousArrayLiterals.ts, 18, 32))
|
|
>derived : Symbol(derived, Decl(heterogeneousArrayLiterals.ts, 24, 3))
|
|
>derived2 : Symbol(derived2, Decl(heterogeneousArrayLiterals.ts, 25, 3))
|
|
}
|
|
|
|
function foo<T, U>(t: T, u: U) {
|
|
>foo : Symbol(foo, Decl(heterogeneousArrayLiterals.ts, 47, 1))
|
|
>T : Symbol(T, Decl(heterogeneousArrayLiterals.ts, 49, 13))
|
|
>U : Symbol(U, Decl(heterogeneousArrayLiterals.ts, 49, 15))
|
|
>t : Symbol(t, Decl(heterogeneousArrayLiterals.ts, 49, 19))
|
|
>T : Symbol(T, Decl(heterogeneousArrayLiterals.ts, 49, 13))
|
|
>u : Symbol(u, Decl(heterogeneousArrayLiterals.ts, 49, 24))
|
|
>U : Symbol(U, Decl(heterogeneousArrayLiterals.ts, 49, 15))
|
|
|
|
var a = [t, t]; // T[]
|
|
>a : Symbol(a, Decl(heterogeneousArrayLiterals.ts, 50, 7))
|
|
>t : Symbol(t, Decl(heterogeneousArrayLiterals.ts, 49, 19))
|
|
>t : Symbol(t, Decl(heterogeneousArrayLiterals.ts, 49, 19))
|
|
|
|
var b = [t, null]; // T[]
|
|
>b : Symbol(b, Decl(heterogeneousArrayLiterals.ts, 51, 7))
|
|
>t : Symbol(t, Decl(heterogeneousArrayLiterals.ts, 49, 19))
|
|
|
|
var c = [t, u]; // {}[]
|
|
>c : Symbol(c, Decl(heterogeneousArrayLiterals.ts, 52, 7))
|
|
>t : Symbol(t, Decl(heterogeneousArrayLiterals.ts, 49, 19))
|
|
>u : Symbol(u, Decl(heterogeneousArrayLiterals.ts, 49, 24))
|
|
|
|
var d = [t, 1]; // {}[]
|
|
>d : Symbol(d, Decl(heterogeneousArrayLiterals.ts, 53, 7))
|
|
>t : Symbol(t, Decl(heterogeneousArrayLiterals.ts, 49, 19))
|
|
|
|
var e = [() => t, () => u]; // {}[]
|
|
>e : Symbol(e, Decl(heterogeneousArrayLiterals.ts, 54, 7))
|
|
>t : Symbol(t, Decl(heterogeneousArrayLiterals.ts, 49, 19))
|
|
>u : Symbol(u, Decl(heterogeneousArrayLiterals.ts, 49, 24))
|
|
|
|
var f = [() => t, () => u, () => null]; // { (): any }[]
|
|
>f : Symbol(f, Decl(heterogeneousArrayLiterals.ts, 55, 7))
|
|
>t : Symbol(t, Decl(heterogeneousArrayLiterals.ts, 49, 19))
|
|
>u : Symbol(u, Decl(heterogeneousArrayLiterals.ts, 49, 24))
|
|
}
|
|
|
|
function foo2<T extends Base, U extends Derived>(t: T, u: U) {
|
|
>foo2 : Symbol(foo2, Decl(heterogeneousArrayLiterals.ts, 56, 1))
|
|
>T : Symbol(T, Decl(heterogeneousArrayLiterals.ts, 58, 14))
|
|
>Base : Symbol(Base, Decl(heterogeneousArrayLiterals.ts, 18, 32))
|
|
>U : Symbol(U, Decl(heterogeneousArrayLiterals.ts, 58, 29))
|
|
>Derived : Symbol(Derived, Decl(heterogeneousArrayLiterals.ts, 20, 27), Decl(heterogeneousArrayLiterals.ts, 25, 23))
|
|
>t : Symbol(t, Decl(heterogeneousArrayLiterals.ts, 58, 49))
|
|
>T : Symbol(T, Decl(heterogeneousArrayLiterals.ts, 58, 14))
|
|
>u : Symbol(u, Decl(heterogeneousArrayLiterals.ts, 58, 54))
|
|
>U : Symbol(U, Decl(heterogeneousArrayLiterals.ts, 58, 29))
|
|
|
|
var a = [t, t]; // T[]
|
|
>a : Symbol(a, Decl(heterogeneousArrayLiterals.ts, 59, 7))
|
|
>t : Symbol(t, Decl(heterogeneousArrayLiterals.ts, 58, 49))
|
|
>t : Symbol(t, Decl(heterogeneousArrayLiterals.ts, 58, 49))
|
|
|
|
var b = [t, null]; // T[]
|
|
>b : Symbol(b, Decl(heterogeneousArrayLiterals.ts, 60, 7))
|
|
>t : Symbol(t, Decl(heterogeneousArrayLiterals.ts, 58, 49))
|
|
|
|
var c = [t, u]; // {}[]
|
|
>c : Symbol(c, Decl(heterogeneousArrayLiterals.ts, 61, 7))
|
|
>t : Symbol(t, Decl(heterogeneousArrayLiterals.ts, 58, 49))
|
|
>u : Symbol(u, Decl(heterogeneousArrayLiterals.ts, 58, 54))
|
|
|
|
var d = [t, 1]; // {}[]
|
|
>d : Symbol(d, Decl(heterogeneousArrayLiterals.ts, 62, 7))
|
|
>t : Symbol(t, Decl(heterogeneousArrayLiterals.ts, 58, 49))
|
|
|
|
var e = [() => t, () => u]; // {}[]
|
|
>e : Symbol(e, Decl(heterogeneousArrayLiterals.ts, 63, 7))
|
|
>t : Symbol(t, Decl(heterogeneousArrayLiterals.ts, 58, 49))
|
|
>u : Symbol(u, Decl(heterogeneousArrayLiterals.ts, 58, 54))
|
|
|
|
var f = [() => t, () => u, () => null]; // { (): any }[]
|
|
>f : Symbol(f, Decl(heterogeneousArrayLiterals.ts, 64, 7))
|
|
>t : Symbol(t, Decl(heterogeneousArrayLiterals.ts, 58, 49))
|
|
>u : Symbol(u, Decl(heterogeneousArrayLiterals.ts, 58, 54))
|
|
|
|
var g = [t, base]; // Base[]
|
|
>g : Symbol(g, Decl(heterogeneousArrayLiterals.ts, 66, 7))
|
|
>t : Symbol(t, Decl(heterogeneousArrayLiterals.ts, 58, 49))
|
|
>base : Symbol(base, Decl(heterogeneousArrayLiterals.ts, 23, 3))
|
|
|
|
var h = [t, derived]; // Derived[]
|
|
>h : Symbol(h, Decl(heterogeneousArrayLiterals.ts, 67, 7))
|
|
>t : Symbol(t, Decl(heterogeneousArrayLiterals.ts, 58, 49))
|
|
>derived : Symbol(derived, Decl(heterogeneousArrayLiterals.ts, 24, 3))
|
|
|
|
var i = [u, base]; // Base[]
|
|
>i : Symbol(i, Decl(heterogeneousArrayLiterals.ts, 68, 7))
|
|
>u : Symbol(u, Decl(heterogeneousArrayLiterals.ts, 58, 54))
|
|
>base : Symbol(base, Decl(heterogeneousArrayLiterals.ts, 23, 3))
|
|
|
|
var j = [u, derived]; // Derived[]
|
|
>j : Symbol(j, Decl(heterogeneousArrayLiterals.ts, 69, 7))
|
|
>u : Symbol(u, Decl(heterogeneousArrayLiterals.ts, 58, 54))
|
|
>derived : Symbol(derived, Decl(heterogeneousArrayLiterals.ts, 24, 3))
|
|
}
|
|
|
|
function foo3<T extends Derived, U extends Derived>(t: T, u: U) {
|
|
>foo3 : Symbol(foo3, Decl(heterogeneousArrayLiterals.ts, 70, 1))
|
|
>T : Symbol(T, Decl(heterogeneousArrayLiterals.ts, 72, 14))
|
|
>Derived : Symbol(Derived, Decl(heterogeneousArrayLiterals.ts, 20, 27), Decl(heterogeneousArrayLiterals.ts, 25, 23))
|
|
>U : Symbol(U, Decl(heterogeneousArrayLiterals.ts, 72, 32))
|
|
>Derived : Symbol(Derived, Decl(heterogeneousArrayLiterals.ts, 20, 27), Decl(heterogeneousArrayLiterals.ts, 25, 23))
|
|
>t : Symbol(t, Decl(heterogeneousArrayLiterals.ts, 72, 52))
|
|
>T : Symbol(T, Decl(heterogeneousArrayLiterals.ts, 72, 14))
|
|
>u : Symbol(u, Decl(heterogeneousArrayLiterals.ts, 72, 57))
|
|
>U : Symbol(U, Decl(heterogeneousArrayLiterals.ts, 72, 32))
|
|
|
|
var a = [t, t]; // T[]
|
|
>a : Symbol(a, Decl(heterogeneousArrayLiterals.ts, 73, 7))
|
|
>t : Symbol(t, Decl(heterogeneousArrayLiterals.ts, 72, 52))
|
|
>t : Symbol(t, Decl(heterogeneousArrayLiterals.ts, 72, 52))
|
|
|
|
var b = [t, null]; // T[]
|
|
>b : Symbol(b, Decl(heterogeneousArrayLiterals.ts, 74, 7))
|
|
>t : Symbol(t, Decl(heterogeneousArrayLiterals.ts, 72, 52))
|
|
|
|
var c = [t, u]; // {}[]
|
|
>c : Symbol(c, Decl(heterogeneousArrayLiterals.ts, 75, 7))
|
|
>t : Symbol(t, Decl(heterogeneousArrayLiterals.ts, 72, 52))
|
|
>u : Symbol(u, Decl(heterogeneousArrayLiterals.ts, 72, 57))
|
|
|
|
var d = [t, 1]; // {}[]
|
|
>d : Symbol(d, Decl(heterogeneousArrayLiterals.ts, 76, 7))
|
|
>t : Symbol(t, Decl(heterogeneousArrayLiterals.ts, 72, 52))
|
|
|
|
var e = [() => t, () => u]; // {}[]
|
|
>e : Symbol(e, Decl(heterogeneousArrayLiterals.ts, 77, 7))
|
|
>t : Symbol(t, Decl(heterogeneousArrayLiterals.ts, 72, 52))
|
|
>u : Symbol(u, Decl(heterogeneousArrayLiterals.ts, 72, 57))
|
|
|
|
var f = [() => t, () => u, () => null]; // { (): any }[]
|
|
>f : Symbol(f, Decl(heterogeneousArrayLiterals.ts, 78, 7))
|
|
>t : Symbol(t, Decl(heterogeneousArrayLiterals.ts, 72, 52))
|
|
>u : Symbol(u, Decl(heterogeneousArrayLiterals.ts, 72, 57))
|
|
|
|
var g = [t, base]; // Base[]
|
|
>g : Symbol(g, Decl(heterogeneousArrayLiterals.ts, 80, 7))
|
|
>t : Symbol(t, Decl(heterogeneousArrayLiterals.ts, 72, 52))
|
|
>base : Symbol(base, Decl(heterogeneousArrayLiterals.ts, 23, 3))
|
|
|
|
var h = [t, derived]; // Derived[]
|
|
>h : Symbol(h, Decl(heterogeneousArrayLiterals.ts, 81, 7))
|
|
>t : Symbol(t, Decl(heterogeneousArrayLiterals.ts, 72, 52))
|
|
>derived : Symbol(derived, Decl(heterogeneousArrayLiterals.ts, 24, 3))
|
|
|
|
var i = [u, base]; // Base[]
|
|
>i : Symbol(i, Decl(heterogeneousArrayLiterals.ts, 82, 7))
|
|
>u : Symbol(u, Decl(heterogeneousArrayLiterals.ts, 72, 57))
|
|
>base : Symbol(base, Decl(heterogeneousArrayLiterals.ts, 23, 3))
|
|
|
|
var j = [u, derived]; // Derived[]
|
|
>j : Symbol(j, Decl(heterogeneousArrayLiterals.ts, 83, 7))
|
|
>u : Symbol(u, Decl(heterogeneousArrayLiterals.ts, 72, 57))
|
|
>derived : Symbol(derived, Decl(heterogeneousArrayLiterals.ts, 24, 3))
|
|
}
|
|
|
|
function foo4<T extends Base, U extends Base>(t: T, u: U) {
|
|
>foo4 : Symbol(foo4, Decl(heterogeneousArrayLiterals.ts, 84, 1))
|
|
>T : Symbol(T, Decl(heterogeneousArrayLiterals.ts, 86, 14))
|
|
>Base : Symbol(Base, Decl(heterogeneousArrayLiterals.ts, 18, 32))
|
|
>U : Symbol(U, Decl(heterogeneousArrayLiterals.ts, 86, 29))
|
|
>Base : Symbol(Base, Decl(heterogeneousArrayLiterals.ts, 18, 32))
|
|
>t : Symbol(t, Decl(heterogeneousArrayLiterals.ts, 86, 46))
|
|
>T : Symbol(T, Decl(heterogeneousArrayLiterals.ts, 86, 14))
|
|
>u : Symbol(u, Decl(heterogeneousArrayLiterals.ts, 86, 51))
|
|
>U : Symbol(U, Decl(heterogeneousArrayLiterals.ts, 86, 29))
|
|
|
|
var a = [t, t]; // T[]
|
|
>a : Symbol(a, Decl(heterogeneousArrayLiterals.ts, 87, 7))
|
|
>t : Symbol(t, Decl(heterogeneousArrayLiterals.ts, 86, 46))
|
|
>t : Symbol(t, Decl(heterogeneousArrayLiterals.ts, 86, 46))
|
|
|
|
var b = [t, null]; // T[]
|
|
>b : Symbol(b, Decl(heterogeneousArrayLiterals.ts, 88, 7))
|
|
>t : Symbol(t, Decl(heterogeneousArrayLiterals.ts, 86, 46))
|
|
|
|
var c = [t, u]; // BUG 821629
|
|
>c : Symbol(c, Decl(heterogeneousArrayLiterals.ts, 89, 7))
|
|
>t : Symbol(t, Decl(heterogeneousArrayLiterals.ts, 86, 46))
|
|
>u : Symbol(u, Decl(heterogeneousArrayLiterals.ts, 86, 51))
|
|
|
|
var d = [t, 1]; // {}[]
|
|
>d : Symbol(d, Decl(heterogeneousArrayLiterals.ts, 90, 7))
|
|
>t : Symbol(t, Decl(heterogeneousArrayLiterals.ts, 86, 46))
|
|
|
|
var e = [() => t, () => u]; // {}[]
|
|
>e : Symbol(e, Decl(heterogeneousArrayLiterals.ts, 91, 7))
|
|
>t : Symbol(t, Decl(heterogeneousArrayLiterals.ts, 86, 46))
|
|
>u : Symbol(u, Decl(heterogeneousArrayLiterals.ts, 86, 51))
|
|
|
|
var f = [() => t, () => u, () => null]; // { (): any }[]
|
|
>f : Symbol(f, Decl(heterogeneousArrayLiterals.ts, 92, 7))
|
|
>t : Symbol(t, Decl(heterogeneousArrayLiterals.ts, 86, 46))
|
|
>u : Symbol(u, Decl(heterogeneousArrayLiterals.ts, 86, 51))
|
|
|
|
var g = [t, base]; // Base[]
|
|
>g : Symbol(g, Decl(heterogeneousArrayLiterals.ts, 94, 7))
|
|
>t : Symbol(t, Decl(heterogeneousArrayLiterals.ts, 86, 46))
|
|
>base : Symbol(base, Decl(heterogeneousArrayLiterals.ts, 23, 3))
|
|
|
|
var h = [t, derived]; // Derived[]
|
|
>h : Symbol(h, Decl(heterogeneousArrayLiterals.ts, 95, 7))
|
|
>t : Symbol(t, Decl(heterogeneousArrayLiterals.ts, 86, 46))
|
|
>derived : Symbol(derived, Decl(heterogeneousArrayLiterals.ts, 24, 3))
|
|
|
|
var i = [u, base]; // Base[]
|
|
>i : Symbol(i, Decl(heterogeneousArrayLiterals.ts, 96, 7))
|
|
>u : Symbol(u, Decl(heterogeneousArrayLiterals.ts, 86, 51))
|
|
>base : Symbol(base, Decl(heterogeneousArrayLiterals.ts, 23, 3))
|
|
|
|
var j = [u, derived]; // Derived[]
|
|
>j : Symbol(j, Decl(heterogeneousArrayLiterals.ts, 97, 7))
|
|
>u : Symbol(u, Decl(heterogeneousArrayLiterals.ts, 86, 51))
|
|
>derived : Symbol(derived, Decl(heterogeneousArrayLiterals.ts, 24, 3))
|
|
|
|
var k: Base[] = [t, u];
|
|
>k : Symbol(k, Decl(heterogeneousArrayLiterals.ts, 99, 7))
|
|
>Base : Symbol(Base, Decl(heterogeneousArrayLiterals.ts, 18, 32))
|
|
>t : Symbol(t, Decl(heterogeneousArrayLiterals.ts, 86, 46))
|
|
>u : Symbol(u, Decl(heterogeneousArrayLiterals.ts, 86, 51))
|
|
}
|
|
|
|
//function foo3<T extends U, U extends Derived>(t: T, u: U) {
|
|
// var a = [t, t]; // T[]
|
|
// var b = [t, null]; // T[]
|
|
// var c = [t, u]; // {}[]
|
|
// var d = [t, 1]; // {}[]
|
|
// var e = [() => t, () => u]; // {}[]
|
|
// var f = [() => t, () => u, () => null]; // { (): any }[]
|
|
|
|
// var g = [t, base]; // Base[]
|
|
// var h = [t, derived]; // Derived[]
|
|
// var i = [u, base]; // Base[]
|
|
// var j = [u, derived]; // Derived[]
|
|
//}
|
|
|
|
//function foo4<T extends U, U extends Base>(t: T, u: U) {
|
|
// var a = [t, t]; // T[]
|
|
// var b = [t, null]; // T[]
|
|
// var c = [t, u]; // BUG 821629
|
|
// var d = [t, 1]; // {}[]
|
|
// var e = [() => t, () => u]; // {}[]
|
|
// var f = [() => t, () => u, () => null]; // { (): any }[]
|
|
|
|
// var g = [t, base]; // Base[]
|
|
// var h = [t, derived]; // Derived[]
|
|
// var i = [u, base]; // Base[]
|
|
// var j = [u, derived]; // Derived[]
|
|
|
|
// var k: Base[] = [t, u];
|
|
//}
|