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