mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
163 lines
6.7 KiB
Plaintext
163 lines
6.7 KiB
Plaintext
//// [tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures2.ts] ////
|
|
|
|
=== assignmentCompatWithCallSignatures2.ts ===
|
|
// void returning call signatures can be assigned a non-void returning call signature that otherwise matches
|
|
|
|
interface T {
|
|
>T : Symbol(T, Decl(assignmentCompatWithCallSignatures2.ts, 0, 0))
|
|
|
|
f(x: number): void;
|
|
>f : Symbol(T.f, Decl(assignmentCompatWithCallSignatures2.ts, 2, 13))
|
|
>x : Symbol(x, Decl(assignmentCompatWithCallSignatures2.ts, 3, 6))
|
|
}
|
|
declare var t: T;
|
|
>t : Symbol(t, Decl(assignmentCompatWithCallSignatures2.ts, 5, 11))
|
|
>T : Symbol(T, Decl(assignmentCompatWithCallSignatures2.ts, 0, 0))
|
|
|
|
declare var a: { f(x: number): void };
|
|
>a : Symbol(a, Decl(assignmentCompatWithCallSignatures2.ts, 6, 11))
|
|
>f : Symbol(f, Decl(assignmentCompatWithCallSignatures2.ts, 6, 16))
|
|
>x : Symbol(x, Decl(assignmentCompatWithCallSignatures2.ts, 6, 19))
|
|
|
|
t = a;
|
|
>t : Symbol(t, Decl(assignmentCompatWithCallSignatures2.ts, 5, 11))
|
|
>a : Symbol(a, Decl(assignmentCompatWithCallSignatures2.ts, 6, 11))
|
|
|
|
a = t;
|
|
>a : Symbol(a, Decl(assignmentCompatWithCallSignatures2.ts, 6, 11))
|
|
>t : Symbol(t, Decl(assignmentCompatWithCallSignatures2.ts, 5, 11))
|
|
|
|
interface S {
|
|
>S : Symbol(S, Decl(assignmentCompatWithCallSignatures2.ts, 9, 6))
|
|
|
|
f(x: number): string;
|
|
>f : Symbol(S.f, Decl(assignmentCompatWithCallSignatures2.ts, 11, 13))
|
|
>x : Symbol(x, Decl(assignmentCompatWithCallSignatures2.ts, 12, 6))
|
|
}
|
|
declare var s: S;
|
|
>s : Symbol(s, Decl(assignmentCompatWithCallSignatures2.ts, 14, 11))
|
|
>S : Symbol(S, Decl(assignmentCompatWithCallSignatures2.ts, 9, 6))
|
|
|
|
declare var a2: { f(x: number): string };
|
|
>a2 : Symbol(a2, Decl(assignmentCompatWithCallSignatures2.ts, 15, 11))
|
|
>f : Symbol(f, Decl(assignmentCompatWithCallSignatures2.ts, 15, 17))
|
|
>x : Symbol(x, Decl(assignmentCompatWithCallSignatures2.ts, 15, 20))
|
|
|
|
t = s;
|
|
>t : Symbol(t, Decl(assignmentCompatWithCallSignatures2.ts, 5, 11))
|
|
>s : Symbol(s, Decl(assignmentCompatWithCallSignatures2.ts, 14, 11))
|
|
|
|
t = a2;
|
|
>t : Symbol(t, Decl(assignmentCompatWithCallSignatures2.ts, 5, 11))
|
|
>a2 : Symbol(a2, Decl(assignmentCompatWithCallSignatures2.ts, 15, 11))
|
|
|
|
a = s;
|
|
>a : Symbol(a, Decl(assignmentCompatWithCallSignatures2.ts, 6, 11))
|
|
>s : Symbol(s, Decl(assignmentCompatWithCallSignatures2.ts, 14, 11))
|
|
|
|
a = a2;
|
|
>a : Symbol(a, Decl(assignmentCompatWithCallSignatures2.ts, 6, 11))
|
|
>a2 : Symbol(a2, Decl(assignmentCompatWithCallSignatures2.ts, 15, 11))
|
|
|
|
t = { f: () => 1 };
|
|
>t : Symbol(t, Decl(assignmentCompatWithCallSignatures2.ts, 5, 11))
|
|
>f : Symbol(f, Decl(assignmentCompatWithCallSignatures2.ts, 21, 5))
|
|
|
|
t = { f: <T>(x:T) => 1 };
|
|
>t : Symbol(t, Decl(assignmentCompatWithCallSignatures2.ts, 5, 11))
|
|
>f : Symbol(f, Decl(assignmentCompatWithCallSignatures2.ts, 22, 5))
|
|
>T : Symbol(T, Decl(assignmentCompatWithCallSignatures2.ts, 22, 10))
|
|
>x : Symbol(x, Decl(assignmentCompatWithCallSignatures2.ts, 22, 13))
|
|
>T : Symbol(T, Decl(assignmentCompatWithCallSignatures2.ts, 22, 10))
|
|
|
|
t = { f: function f() { return 1 } };
|
|
>t : Symbol(t, Decl(assignmentCompatWithCallSignatures2.ts, 5, 11))
|
|
>f : Symbol(f, Decl(assignmentCompatWithCallSignatures2.ts, 23, 5))
|
|
>f : Symbol(f, Decl(assignmentCompatWithCallSignatures2.ts, 23, 8))
|
|
|
|
t = { f(x: number) { return ''; } }
|
|
>t : Symbol(t, Decl(assignmentCompatWithCallSignatures2.ts, 5, 11))
|
|
>f : Symbol(f, Decl(assignmentCompatWithCallSignatures2.ts, 24, 5))
|
|
>x : Symbol(x, Decl(assignmentCompatWithCallSignatures2.ts, 24, 8))
|
|
|
|
a = { f: () => 1 }
|
|
>a : Symbol(a, Decl(assignmentCompatWithCallSignatures2.ts, 6, 11))
|
|
>f : Symbol(f, Decl(assignmentCompatWithCallSignatures2.ts, 25, 5))
|
|
|
|
a = { f: <T>(x: T) => 1 };
|
|
>a : Symbol(a, Decl(assignmentCompatWithCallSignatures2.ts, 6, 11))
|
|
>f : Symbol(f, Decl(assignmentCompatWithCallSignatures2.ts, 26, 5))
|
|
>T : Symbol(T, Decl(assignmentCompatWithCallSignatures2.ts, 26, 10))
|
|
>x : Symbol(x, Decl(assignmentCompatWithCallSignatures2.ts, 26, 13))
|
|
>T : Symbol(T, Decl(assignmentCompatWithCallSignatures2.ts, 26, 10))
|
|
|
|
a = { f: function (x: number) { return ''; } }
|
|
>a : Symbol(a, Decl(assignmentCompatWithCallSignatures2.ts, 6, 11))
|
|
>f : Symbol(f, Decl(assignmentCompatWithCallSignatures2.ts, 27, 5))
|
|
>x : Symbol(x, Decl(assignmentCompatWithCallSignatures2.ts, 27, 19))
|
|
|
|
// errors
|
|
t = () => 1;
|
|
>t : Symbol(t, Decl(assignmentCompatWithCallSignatures2.ts, 5, 11))
|
|
|
|
t = function (x: number) { return ''; }
|
|
>t : Symbol(t, Decl(assignmentCompatWithCallSignatures2.ts, 5, 11))
|
|
>x : Symbol(x, Decl(assignmentCompatWithCallSignatures2.ts, 31, 14))
|
|
|
|
a = () => 1;
|
|
>a : Symbol(a, Decl(assignmentCompatWithCallSignatures2.ts, 6, 11))
|
|
|
|
a = function (x: number) { return ''; }
|
|
>a : Symbol(a, Decl(assignmentCompatWithCallSignatures2.ts, 6, 11))
|
|
>x : Symbol(x, Decl(assignmentCompatWithCallSignatures2.ts, 33, 14))
|
|
|
|
interface S2 {
|
|
>S2 : Symbol(S2, Decl(assignmentCompatWithCallSignatures2.ts, 33, 39))
|
|
|
|
f(x: string): void;
|
|
>f : Symbol(S2.f, Decl(assignmentCompatWithCallSignatures2.ts, 35, 14))
|
|
>x : Symbol(x, Decl(assignmentCompatWithCallSignatures2.ts, 36, 6))
|
|
}
|
|
declare var s2: S2;
|
|
>s2 : Symbol(s2, Decl(assignmentCompatWithCallSignatures2.ts, 38, 11))
|
|
>S2 : Symbol(S2, Decl(assignmentCompatWithCallSignatures2.ts, 33, 39))
|
|
|
|
declare var a3: { f(x: string): void };
|
|
>a3 : Symbol(a3, Decl(assignmentCompatWithCallSignatures2.ts, 39, 11))
|
|
>f : Symbol(f, Decl(assignmentCompatWithCallSignatures2.ts, 39, 17))
|
|
>x : Symbol(x, Decl(assignmentCompatWithCallSignatures2.ts, 39, 20))
|
|
|
|
// these are errors
|
|
t = s2;
|
|
>t : Symbol(t, Decl(assignmentCompatWithCallSignatures2.ts, 5, 11))
|
|
>s2 : Symbol(s2, Decl(assignmentCompatWithCallSignatures2.ts, 38, 11))
|
|
|
|
t = a3;
|
|
>t : Symbol(t, Decl(assignmentCompatWithCallSignatures2.ts, 5, 11))
|
|
>a3 : Symbol(a3, Decl(assignmentCompatWithCallSignatures2.ts, 39, 11))
|
|
|
|
t = (x: string) => 1;
|
|
>t : Symbol(t, Decl(assignmentCompatWithCallSignatures2.ts, 5, 11))
|
|
>x : Symbol(x, Decl(assignmentCompatWithCallSignatures2.ts, 43, 5))
|
|
|
|
t = function (x: string) { return ''; }
|
|
>t : Symbol(t, Decl(assignmentCompatWithCallSignatures2.ts, 5, 11))
|
|
>x : Symbol(x, Decl(assignmentCompatWithCallSignatures2.ts, 44, 14))
|
|
|
|
a = s2;
|
|
>a : Symbol(a, Decl(assignmentCompatWithCallSignatures2.ts, 6, 11))
|
|
>s2 : Symbol(s2, Decl(assignmentCompatWithCallSignatures2.ts, 38, 11))
|
|
|
|
a = a3;
|
|
>a : Symbol(a, Decl(assignmentCompatWithCallSignatures2.ts, 6, 11))
|
|
>a3 : Symbol(a3, Decl(assignmentCompatWithCallSignatures2.ts, 39, 11))
|
|
|
|
a = (x: string) => 1;
|
|
>a : Symbol(a, Decl(assignmentCompatWithCallSignatures2.ts, 6, 11))
|
|
>x : Symbol(x, Decl(assignmentCompatWithCallSignatures2.ts, 47, 5))
|
|
|
|
a = function (x: string) { return ''; }
|
|
>a : Symbol(a, Decl(assignmentCompatWithCallSignatures2.ts, 6, 11))
|
|
>x : Symbol(x, Decl(assignmentCompatWithCallSignatures2.ts, 48, 14))
|
|
|