mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
69 lines
2.3 KiB
Plaintext
69 lines
2.3 KiB
Plaintext
//// [tests/cases/compiler/circularVariance2.ts] ////
|
|
|
|
=== circularVariance2.ts ===
|
|
// https://github.com/microsoft/typescript-go/pull/4820
|
|
|
|
type Bar<U> = (x: Baz<U[]>) => void;
|
|
>Bar : Symbol(Bar, Decl(circularVariance2.ts, 0, 0))
|
|
>U : Symbol(U, Decl(circularVariance2.ts, 2, 9))
|
|
>x : Symbol(x, Decl(circularVariance2.ts, 2, 15))
|
|
>Baz : Symbol(Baz, Decl(circularVariance2.ts, 2, 36))
|
|
>U : Symbol(U, Decl(circularVariance2.ts, 2, 9))
|
|
|
|
type Baz<V> = {
|
|
>Baz : Symbol(Baz, Decl(circularVariance2.ts, 2, 36))
|
|
>V : Symbol(V, Decl(circularVariance2.ts, 4, 9))
|
|
|
|
value: Foo<V[]>;
|
|
>value : Symbol(value, Decl(circularVariance2.ts, 4, 15))
|
|
>Foo : Symbol(Foo, Decl(circularVariance2.ts, 6, 1))
|
|
>V : Symbol(V, Decl(circularVariance2.ts, 4, 9))
|
|
}
|
|
|
|
type Foo<T> = {
|
|
>Foo : Symbol(Foo, Decl(circularVariance2.ts, 6, 1))
|
|
>T : Symbol(T, Decl(circularVariance2.ts, 8, 9))
|
|
|
|
x: T;
|
|
>x : Symbol(x, Decl(circularVariance2.ts, 8, 15))
|
|
>T : Symbol(T, Decl(circularVariance2.ts, 8, 9))
|
|
|
|
f: Bar<T>;
|
|
>f : Symbol(f, Decl(circularVariance2.ts, 9, 9))
|
|
>Bar : Symbol(Bar, Decl(circularVariance2.ts, 0, 0))
|
|
>T : Symbol(T, Decl(circularVariance2.ts, 8, 9))
|
|
}
|
|
|
|
declare let bar1: Bar<unknown>;
|
|
>bar1 : Symbol(bar1, Decl(circularVariance2.ts, 13, 11))
|
|
>Bar : Symbol(Bar, Decl(circularVariance2.ts, 0, 0))
|
|
|
|
declare let bar2: Bar<string>;
|
|
>bar2 : Symbol(bar2, Decl(circularVariance2.ts, 14, 11))
|
|
>Bar : Symbol(Bar, Decl(circularVariance2.ts, 0, 0))
|
|
|
|
bar1 = bar2; // Error
|
|
>bar1 : Symbol(bar1, Decl(circularVariance2.ts, 13, 11))
|
|
>bar2 : Symbol(bar2, Decl(circularVariance2.ts, 14, 11))
|
|
|
|
bar2 = bar1;
|
|
>bar2 : Symbol(bar2, Decl(circularVariance2.ts, 14, 11))
|
|
>bar1 : Symbol(bar1, Decl(circularVariance2.ts, 13, 11))
|
|
|
|
declare let foo1: Foo<unknown>;
|
|
>foo1 : Symbol(foo1, Decl(circularVariance2.ts, 19, 11))
|
|
>Foo : Symbol(Foo, Decl(circularVariance2.ts, 6, 1))
|
|
|
|
declare let foo2: Foo<string>;
|
|
>foo2 : Symbol(foo2, Decl(circularVariance2.ts, 20, 11))
|
|
>Foo : Symbol(Foo, Decl(circularVariance2.ts, 6, 1))
|
|
|
|
foo1 = foo2;
|
|
>foo1 : Symbol(foo1, Decl(circularVariance2.ts, 19, 11))
|
|
>foo2 : Symbol(foo2, Decl(circularVariance2.ts, 20, 11))
|
|
|
|
foo2 = foo1; // Error
|
|
>foo2 : Symbol(foo2, Decl(circularVariance2.ts, 20, 11))
|
|
>foo1 : Symbol(foo1, Decl(circularVariance2.ts, 19, 11))
|
|
|