mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
105 lines
4.2 KiB
Plaintext
105 lines
4.2 KiB
Plaintext
//// [tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures.ts] ////
|
|
|
|
=== assignmentCompatWithConstructSignatures.ts ===
|
|
// void returning call signatures can be assigned a non-void returning call signature that otherwise matches
|
|
|
|
interface T {
|
|
>T : Symbol(T, Decl(assignmentCompatWithConstructSignatures.ts, 0, 0))
|
|
|
|
new (x: number): void;
|
|
>x : Symbol(x, Decl(assignmentCompatWithConstructSignatures.ts, 3, 9))
|
|
}
|
|
declare var t: T;
|
|
>t : Symbol(t, Decl(assignmentCompatWithConstructSignatures.ts, 5, 11))
|
|
>T : Symbol(T, Decl(assignmentCompatWithConstructSignatures.ts, 0, 0))
|
|
|
|
declare var a: { new (x: number): void };
|
|
>a : Symbol(a, Decl(assignmentCompatWithConstructSignatures.ts, 6, 11))
|
|
>x : Symbol(x, Decl(assignmentCompatWithConstructSignatures.ts, 6, 22))
|
|
|
|
t = a;
|
|
>t : Symbol(t, Decl(assignmentCompatWithConstructSignatures.ts, 5, 11))
|
|
>a : Symbol(a, Decl(assignmentCompatWithConstructSignatures.ts, 6, 11))
|
|
|
|
a = t;
|
|
>a : Symbol(a, Decl(assignmentCompatWithConstructSignatures.ts, 6, 11))
|
|
>t : Symbol(t, Decl(assignmentCompatWithConstructSignatures.ts, 5, 11))
|
|
|
|
interface S {
|
|
>S : Symbol(S, Decl(assignmentCompatWithConstructSignatures.ts, 9, 6))
|
|
|
|
new (x: number): string;
|
|
>x : Symbol(x, Decl(assignmentCompatWithConstructSignatures.ts, 12, 9))
|
|
}
|
|
declare var s: S;
|
|
>s : Symbol(s, Decl(assignmentCompatWithConstructSignatures.ts, 14, 11))
|
|
>S : Symbol(S, Decl(assignmentCompatWithConstructSignatures.ts, 9, 6))
|
|
|
|
declare var a2: { new (x: number): string };
|
|
>a2 : Symbol(a2, Decl(assignmentCompatWithConstructSignatures.ts, 15, 11))
|
|
>x : Symbol(x, Decl(assignmentCompatWithConstructSignatures.ts, 15, 23))
|
|
|
|
t = s;
|
|
>t : Symbol(t, Decl(assignmentCompatWithConstructSignatures.ts, 5, 11))
|
|
>s : Symbol(s, Decl(assignmentCompatWithConstructSignatures.ts, 14, 11))
|
|
|
|
t = a2;
|
|
>t : Symbol(t, Decl(assignmentCompatWithConstructSignatures.ts, 5, 11))
|
|
>a2 : Symbol(a2, Decl(assignmentCompatWithConstructSignatures.ts, 15, 11))
|
|
|
|
a = s;
|
|
>a : Symbol(a, Decl(assignmentCompatWithConstructSignatures.ts, 6, 11))
|
|
>s : Symbol(s, Decl(assignmentCompatWithConstructSignatures.ts, 14, 11))
|
|
|
|
a = a2;
|
|
>a : Symbol(a, Decl(assignmentCompatWithConstructSignatures.ts, 6, 11))
|
|
>a2 : Symbol(a2, Decl(assignmentCompatWithConstructSignatures.ts, 15, 11))
|
|
|
|
interface S2 {
|
|
>S2 : Symbol(S2, Decl(assignmentCompatWithConstructSignatures.ts, 19, 7))
|
|
|
|
(x: string): void;
|
|
>x : Symbol(x, Decl(assignmentCompatWithConstructSignatures.ts, 22, 5))
|
|
}
|
|
declare var s2: S2;
|
|
>s2 : Symbol(s2, Decl(assignmentCompatWithConstructSignatures.ts, 24, 11))
|
|
>S2 : Symbol(S2, Decl(assignmentCompatWithConstructSignatures.ts, 19, 7))
|
|
|
|
declare var a3: { (x: string): void };
|
|
>a3 : Symbol(a3, Decl(assignmentCompatWithConstructSignatures.ts, 25, 11))
|
|
>x : Symbol(x, Decl(assignmentCompatWithConstructSignatures.ts, 25, 19))
|
|
|
|
// these are errors
|
|
t = s2;
|
|
>t : Symbol(t, Decl(assignmentCompatWithConstructSignatures.ts, 5, 11))
|
|
>s2 : Symbol(s2, Decl(assignmentCompatWithConstructSignatures.ts, 24, 11))
|
|
|
|
t = a3;
|
|
>t : Symbol(t, Decl(assignmentCompatWithConstructSignatures.ts, 5, 11))
|
|
>a3 : Symbol(a3, Decl(assignmentCompatWithConstructSignatures.ts, 25, 11))
|
|
|
|
t = (x: string) => 1;
|
|
>t : Symbol(t, Decl(assignmentCompatWithConstructSignatures.ts, 5, 11))
|
|
>x : Symbol(x, Decl(assignmentCompatWithConstructSignatures.ts, 29, 5))
|
|
|
|
t = function (x: string) { return ''; }
|
|
>t : Symbol(t, Decl(assignmentCompatWithConstructSignatures.ts, 5, 11))
|
|
>x : Symbol(x, Decl(assignmentCompatWithConstructSignatures.ts, 30, 14))
|
|
|
|
a = s2;
|
|
>a : Symbol(a, Decl(assignmentCompatWithConstructSignatures.ts, 6, 11))
|
|
>s2 : Symbol(s2, Decl(assignmentCompatWithConstructSignatures.ts, 24, 11))
|
|
|
|
a = a3;
|
|
>a : Symbol(a, Decl(assignmentCompatWithConstructSignatures.ts, 6, 11))
|
|
>a3 : Symbol(a3, Decl(assignmentCompatWithConstructSignatures.ts, 25, 11))
|
|
|
|
a = (x: string) => 1;
|
|
>a : Symbol(a, Decl(assignmentCompatWithConstructSignatures.ts, 6, 11))
|
|
>x : Symbol(x, Decl(assignmentCompatWithConstructSignatures.ts, 33, 5))
|
|
|
|
a = function (x: string) { return ''; }
|
|
>a : Symbol(a, Decl(assignmentCompatWithConstructSignatures.ts, 6, 11))
|
|
>x : Symbol(x, Decl(assignmentCompatWithConstructSignatures.ts, 34, 14))
|
|
|