1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160
|
=== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/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))
}
var t: T;
>t : Symbol(t, Decl(assignmentCompatWithCallSignatures2.ts, 5, 3))
>T : Symbol(T, Decl(assignmentCompatWithCallSignatures2.ts, 0, 0))
var a: { f(x: number): void };
>a : Symbol(a, Decl(assignmentCompatWithCallSignatures2.ts, 6, 3))
>f : Symbol(f, Decl(assignmentCompatWithCallSignatures2.ts, 6, 8))
>x : Symbol(x, Decl(assignmentCompatWithCallSignatures2.ts, 6, 11))
t = a;
>t : Symbol(t, Decl(assignmentCompatWithCallSignatures2.ts, 5, 3))
>a : Symbol(a, Decl(assignmentCompatWithCallSignatures2.ts, 6, 3))
a = t;
>a : Symbol(a, Decl(assignmentCompatWithCallSignatures2.ts, 6, 3))
>t : Symbol(t, Decl(assignmentCompatWithCallSignatures2.ts, 5, 3))
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))
}
var s: S;
>s : Symbol(s, Decl(assignmentCompatWithCallSignatures2.ts, 14, 3))
>S : Symbol(S, Decl(assignmentCompatWithCallSignatures2.ts, 9, 6))
var a2: { f(x: number): string };
>a2 : Symbol(a2, Decl(assignmentCompatWithCallSignatures2.ts, 15, 3))
>f : Symbol(f, Decl(assignmentCompatWithCallSignatures2.ts, 15, 9))
>x : Symbol(x, Decl(assignmentCompatWithCallSignatures2.ts, 15, 12))
t = s;
>t : Symbol(t, Decl(assignmentCompatWithCallSignatures2.ts, 5, 3))
>s : Symbol(s, Decl(assignmentCompatWithCallSignatures2.ts, 14, 3))
t = a2;
>t : Symbol(t, Decl(assignmentCompatWithCallSignatures2.ts, 5, 3))
>a2 : Symbol(a2, Decl(assignmentCompatWithCallSignatures2.ts, 15, 3))
a = s;
>a : Symbol(a, Decl(assignmentCompatWithCallSignatures2.ts, 6, 3))
>s : Symbol(s, Decl(assignmentCompatWithCallSignatures2.ts, 14, 3))
a = a2;
>a : Symbol(a, Decl(assignmentCompatWithCallSignatures2.ts, 6, 3))
>a2 : Symbol(a2, Decl(assignmentCompatWithCallSignatures2.ts, 15, 3))
t = { f: () => 1 };
>t : Symbol(t, Decl(assignmentCompatWithCallSignatures2.ts, 5, 3))
>f : Symbol(f, Decl(assignmentCompatWithCallSignatures2.ts, 21, 5))
t = { f: <T>(x:T) => 1 };
>t : Symbol(t, Decl(assignmentCompatWithCallSignatures2.ts, 5, 3))
>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, 3))
>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, 3))
>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, 3))
>f : Symbol(f, Decl(assignmentCompatWithCallSignatures2.ts, 25, 5))
a = { f: <T>(x: T) => 1 };
>a : Symbol(a, Decl(assignmentCompatWithCallSignatures2.ts, 6, 3))
>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, 3))
>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, 3))
t = function (x: number) { return ''; }
>t : Symbol(t, Decl(assignmentCompatWithCallSignatures2.ts, 5, 3))
>x : Symbol(x, Decl(assignmentCompatWithCallSignatures2.ts, 31, 14))
a = () => 1;
>a : Symbol(a, Decl(assignmentCompatWithCallSignatures2.ts, 6, 3))
a = function (x: number) { return ''; }
>a : Symbol(a, Decl(assignmentCompatWithCallSignatures2.ts, 6, 3))
>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))
}
var s2: S2;
>s2 : Symbol(s2, Decl(assignmentCompatWithCallSignatures2.ts, 38, 3))
>S2 : Symbol(S2, Decl(assignmentCompatWithCallSignatures2.ts, 33, 39))
var a3: { f(x: string): void };
>a3 : Symbol(a3, Decl(assignmentCompatWithCallSignatures2.ts, 39, 3))
>f : Symbol(f, Decl(assignmentCompatWithCallSignatures2.ts, 39, 9))
>x : Symbol(x, Decl(assignmentCompatWithCallSignatures2.ts, 39, 12))
// these are errors
t = s2;
>t : Symbol(t, Decl(assignmentCompatWithCallSignatures2.ts, 5, 3))
>s2 : Symbol(s2, Decl(assignmentCompatWithCallSignatures2.ts, 38, 3))
t = a3;
>t : Symbol(t, Decl(assignmentCompatWithCallSignatures2.ts, 5, 3))
>a3 : Symbol(a3, Decl(assignmentCompatWithCallSignatures2.ts, 39, 3))
t = (x: string) => 1;
>t : Symbol(t, Decl(assignmentCompatWithCallSignatures2.ts, 5, 3))
>x : Symbol(x, Decl(assignmentCompatWithCallSignatures2.ts, 43, 5))
t = function (x: string) { return ''; }
>t : Symbol(t, Decl(assignmentCompatWithCallSignatures2.ts, 5, 3))
>x : Symbol(x, Decl(assignmentCompatWithCallSignatures2.ts, 44, 14))
a = s2;
>a : Symbol(a, Decl(assignmentCompatWithCallSignatures2.ts, 6, 3))
>s2 : Symbol(s2, Decl(assignmentCompatWithCallSignatures2.ts, 38, 3))
a = a3;
>a : Symbol(a, Decl(assignmentCompatWithCallSignatures2.ts, 6, 3))
>a3 : Symbol(a3, Decl(assignmentCompatWithCallSignatures2.ts, 39, 3))
a = (x: string) => 1;
>a : Symbol(a, Decl(assignmentCompatWithCallSignatures2.ts, 6, 3))
>x : Symbol(x, Decl(assignmentCompatWithCallSignatures2.ts, 47, 5))
a = function (x: string) { return ''; }
>a : Symbol(a, Decl(assignmentCompatWithCallSignatures2.ts, 6, 3))
>x : Symbol(x, Decl(assignmentCompatWithCallSignatures2.ts, 48, 14))
|