mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
135 lines
4.6 KiB
Plaintext
135 lines
4.6 KiB
Plaintext
//// [tests/cases/conformance/classes/members/constructorFunctionTypes/classWithConstructors.ts] ////
|
|
|
|
=== classWithConstructors.ts ===
|
|
namespace NonGeneric {
|
|
>NonGeneric : Symbol(NonGeneric, Decl(classWithConstructors.ts, 0, 0))
|
|
|
|
class C {
|
|
>C : Symbol(C, Decl(classWithConstructors.ts, 0, 22))
|
|
|
|
constructor(x: string) { }
|
|
>x : Symbol(x, Decl(classWithConstructors.ts, 2, 20))
|
|
}
|
|
|
|
var c = new C(); // error
|
|
>c : Symbol(c, Decl(classWithConstructors.ts, 5, 7))
|
|
>C : Symbol(C, Decl(classWithConstructors.ts, 0, 22))
|
|
|
|
var c2 = new C(''); // ok
|
|
>c2 : Symbol(c2, Decl(classWithConstructors.ts, 6, 7))
|
|
>C : Symbol(C, Decl(classWithConstructors.ts, 0, 22))
|
|
|
|
class C2 {
|
|
>C2 : Symbol(C2, Decl(classWithConstructors.ts, 6, 23))
|
|
|
|
constructor(x: number);
|
|
>x : Symbol(x, Decl(classWithConstructors.ts, 9, 20))
|
|
|
|
constructor(x: string);
|
|
>x : Symbol(x, Decl(classWithConstructors.ts, 10, 20))
|
|
|
|
constructor(x: any) { }
|
|
>x : Symbol(x, Decl(classWithConstructors.ts, 11, 20))
|
|
}
|
|
|
|
var c3 = new C2(); // error
|
|
>c3 : Symbol(c3, Decl(classWithConstructors.ts, 14, 7))
|
|
>C2 : Symbol(C2, Decl(classWithConstructors.ts, 6, 23))
|
|
|
|
var c4 = new C2(''); // ok
|
|
>c4 : Symbol(c4, Decl(classWithConstructors.ts, 15, 7))
|
|
>C2 : Symbol(C2, Decl(classWithConstructors.ts, 6, 23))
|
|
|
|
var c5 = new C2(1); // ok
|
|
>c5 : Symbol(c5, Decl(classWithConstructors.ts, 16, 7))
|
|
>C2 : Symbol(C2, Decl(classWithConstructors.ts, 6, 23))
|
|
|
|
class D extends C2 { }
|
|
>D : Symbol(D, Decl(classWithConstructors.ts, 16, 23))
|
|
>C2 : Symbol(C2, Decl(classWithConstructors.ts, 6, 23))
|
|
|
|
var d = new D(); // error
|
|
>d : Symbol(d, Decl(classWithConstructors.ts, 20, 7))
|
|
>D : Symbol(D, Decl(classWithConstructors.ts, 16, 23))
|
|
|
|
var d2 = new D(1); // ok
|
|
>d2 : Symbol(d2, Decl(classWithConstructors.ts, 21, 7))
|
|
>D : Symbol(D, Decl(classWithConstructors.ts, 16, 23))
|
|
|
|
var d3 = new D(''); // ok
|
|
>d3 : Symbol(d3, Decl(classWithConstructors.ts, 22, 7))
|
|
>D : Symbol(D, Decl(classWithConstructors.ts, 16, 23))
|
|
}
|
|
|
|
namespace Generics {
|
|
>Generics : Symbol(Generics, Decl(classWithConstructors.ts, 23, 1))
|
|
|
|
class C<T> {
|
|
>C : Symbol(C, Decl(classWithConstructors.ts, 25, 20))
|
|
>T : Symbol(T, Decl(classWithConstructors.ts, 26, 12))
|
|
|
|
constructor(x: T) { }
|
|
>x : Symbol(x, Decl(classWithConstructors.ts, 27, 20))
|
|
>T : Symbol(T, Decl(classWithConstructors.ts, 26, 12))
|
|
}
|
|
|
|
var c = new C(); // error
|
|
>c : Symbol(c, Decl(classWithConstructors.ts, 30, 7))
|
|
>C : Symbol(C, Decl(classWithConstructors.ts, 25, 20))
|
|
|
|
var c2 = new C(''); // ok
|
|
>c2 : Symbol(c2, Decl(classWithConstructors.ts, 31, 7))
|
|
>C : Symbol(C, Decl(classWithConstructors.ts, 25, 20))
|
|
|
|
class C2<T,U> {
|
|
>C2 : Symbol(C2, Decl(classWithConstructors.ts, 31, 23))
|
|
>T : Symbol(T, Decl(classWithConstructors.ts, 33, 13))
|
|
>U : Symbol(U, Decl(classWithConstructors.ts, 33, 15))
|
|
|
|
constructor(x: T);
|
|
>x : Symbol(x, Decl(classWithConstructors.ts, 34, 20))
|
|
>T : Symbol(T, Decl(classWithConstructors.ts, 33, 13))
|
|
|
|
constructor(x: T, y: U);
|
|
>x : Symbol(x, Decl(classWithConstructors.ts, 35, 20))
|
|
>T : Symbol(T, Decl(classWithConstructors.ts, 33, 13))
|
|
>y : Symbol(y, Decl(classWithConstructors.ts, 35, 25))
|
|
>U : Symbol(U, Decl(classWithConstructors.ts, 33, 15))
|
|
|
|
constructor(x: any) { }
|
|
>x : Symbol(x, Decl(classWithConstructors.ts, 36, 20))
|
|
}
|
|
|
|
var c3 = new C2(); // error
|
|
>c3 : Symbol(c3, Decl(classWithConstructors.ts, 39, 7))
|
|
>C2 : Symbol(C2, Decl(classWithConstructors.ts, 31, 23))
|
|
|
|
var c4 = new C2(''); // ok
|
|
>c4 : Symbol(c4, Decl(classWithConstructors.ts, 40, 7))
|
|
>C2 : Symbol(C2, Decl(classWithConstructors.ts, 31, 23))
|
|
|
|
var c5 = new C2(1, 2); // ok
|
|
>c5 : Symbol(c5, Decl(classWithConstructors.ts, 41, 7))
|
|
>C2 : Symbol(C2, Decl(classWithConstructors.ts, 31, 23))
|
|
|
|
class D<T, U> extends C2<T, U> { }
|
|
>D : Symbol(D, Decl(classWithConstructors.ts, 41, 26))
|
|
>T : Symbol(T, Decl(classWithConstructors.ts, 43, 12))
|
|
>U : Symbol(U, Decl(classWithConstructors.ts, 43, 14))
|
|
>C2 : Symbol(C2, Decl(classWithConstructors.ts, 31, 23))
|
|
>T : Symbol(T, Decl(classWithConstructors.ts, 43, 12))
|
|
>U : Symbol(U, Decl(classWithConstructors.ts, 43, 14))
|
|
|
|
var d = new D(); // error
|
|
>d : Symbol(d, Decl(classWithConstructors.ts, 45, 7))
|
|
>D : Symbol(D, Decl(classWithConstructors.ts, 41, 26))
|
|
|
|
var d2 = new D(1); // ok
|
|
>d2 : Symbol(d2, Decl(classWithConstructors.ts, 46, 7))
|
|
>D : Symbol(D, Decl(classWithConstructors.ts, 41, 26))
|
|
|
|
var d3 = new D(''); // ok
|
|
>d3 : Symbol(d3, Decl(classWithConstructors.ts, 47, 7))
|
|
>D : Symbol(D, Decl(classWithConstructors.ts, 41, 26))
|
|
}
|