/arkcompiler/ets_runtime/test/typeinfer/automatedcases/ |
D | inferenceOfNullableObjectTypesWithCommonBase.ts | 30 type B = { foo: string } alias 33 equal(v as B, v as undefined | D) 34 AssertType(equal(v as B, v as undefined | D), "void"); 36 AssertType(v as B, "B"); 41 equal(v as undefined | D, v as B) 42 AssertType(equal(v as undefined | D, v as B), "void"); 46 AssertType(v as B, "B"); 49 equal<undefined | B>(v as B, v as undefined | D) 50 AssertType(equal<undefined | B>(v as B, v as undefined | D), "void"); 52 AssertType(v as B, "B"); [all …]
|
D | privateNameStaticFieldClassExpression.ts | 21 class B { 29 new B.#foo2(); 30 AssertType(new B.#foo2(), "Foo"); 31 AssertType(B.#foo2, "typeof Foo"); 41 console.log(B.#foo.test) 42 AssertType(console.log(B.#foo.test), "void"); 44 AssertType(B.#foo.test, "number"); 45 AssertType(B.#foo, "typeof (Anonymous class)"); 47 B.#foo.test = 10; 48 AssertType(B.#foo.test = 10, "int"); [all …]
|
D | inheritanceOfGenericConstructorMethod1.ts | 22 class B<T> extends A<T> {} class 28 let b1 = new B(); // no error 30 AssertType(new B(), "B<unknown>"); 31 AssertType(B, "typeof B"); 33 let b2: B<Date> = new B<Date>(); // no error 35 AssertType(new B<Date>(), "B<Date>"); 36 AssertType(B, "typeof B"); 38 let b3 = new B<Date>(); // error, could not select overload for 'new' expression 40 AssertType(new B<Date>(), "B<Date>"); 41 AssertType(B, "typeof B");
|
D | enumMemberReduction.ts | 23 B, 29 B = "b", enumerator 35 B = "b", enumerator 47 AssertType(optionalEnum || MyEnum.B, "union"); 49 AssertType(MyEnum.B, "MyEnum.B"); 50 return optionalEnum || MyEnum.B; 61 AssertType(optionalEnum || MyEnum.B, "union"); 63 AssertType(MyEnum.B, "MyEnum.B"); 64 return optionalEnum || MyEnum.B; 68 AssertType(optionalEnum || MyStringEnum.B, "MyStringEnum"); [all …]
|
D | abstractClassInLocalScope.ts | 22 AssertType((() => { abstract class A {} class B extends A {} new B(); return A;}), "() … 23 AssertType(() => { abstract class A {} class B extends A {} new B(); return A;}, "() =>… 24 AssertType((() => { abstract class A {} class B extends A {} new B(); return A;})(), "t… 27 class B extends A {} 28 new B(); 29 AssertType(new B(), "B"); 30 AssertType(B, "typeof B");
|
D | enumBasics.ts | 24 B, 45 readonly B: E1.B; variable 46 AssertType(B, "E1.B"); 74 A = 1, B = 2, C = 3 enumerator 90 B = 3, enumerator 96 B = 0, enumerator 107 B = 'foo'['foo'] enumerator 113 B = A enumerator 120 AssertType([ E8.B, E7.A, E4.Z, E3.X, E3.Y, E3.Z], "(union)[]"); 122 E8.B, E7.A, E4.Z, E3.X, E3.Y, E3.Z [all …]
|
D | narrowingOrderIndependent.ts | 27 class B { class 38 new B(a.stringOrUndefined) 39 AssertType(new B(a.stringOrUndefined), "B"); 40 AssertType(B, "typeof B"); 45 new B(a.stringOrUndefined) 46 AssertType(new B(a.stringOrUndefined), "B"); 47 AssertType(B, "typeof B"); 55 new B(a.stringOrUndefined) 56 AssertType(new B(a.stringOrUndefined), "B"); 57 AssertType(B, "typeof B"); [all …]
|
D | propertyAccessOnTypeParameterWithConstraints3.ts | 30 class B extends A { class 74 let r1a = (new C<A, B>()).f(); 76 AssertType((new C<A, B>()).f(), "string"); 77 AssertType((new C<A, B>()).f, "() => string"); 79 let r1b = (new C<A, B>()).g(new B()); 81 AssertType((new C<A, B>()).g(new B()), "string"); 82 AssertType((new C<A, B>()).g, "(A) => string"); 83 AssertType(new B(), "B"); 84 AssertType(B, "typeof B"); 89 let i: I<A, B>; [all …]
|
D | emitClassDeclarationWithTypeArgumentInES6.ts | 21 class B<T> { 23 B: T; 24 constructor(a: T) { this.B = a; 25 AssertType(this.B = a, "T"); 27 AssertType(this.B, "T"); 40 AssertType(this.B, "T"); 42 return this.B; 45 this.B = c; 46 AssertType(this.B = c, "T"); 47 AssertType(this.B, "T");
|
D | localTypes1.ts | 25 A, B, C 27 AssertType(B, "E.B"); 46 a[0].x = E.B; 47 AssertType(a[0].x = E.B, "E.B"); 52 AssertType(E.B, "E.B"); 65 A, B, C 67 AssertType(B, "E.B"); 86 a[0].x = E.B; 87 AssertType(a[0].x = E.B, "E.B"); 92 AssertType(E.B, "E.B"); [all …]
|
D | declFileGenericType.ts | 23 export class B { } 25 export function F<T>(x: T): A<B> { 30 export function F2<T>(x: T): C.A<C.B> { 35 export function F3<T>(x: T): C.A<C.B>[] { 40 export function F4<T extends A<B>>(x: T): Array<C.A<C.B>> { 50 export function F6<T extends A<B>>(x: T): T { 62 export let a: C.A<C.B>; 83 export let x = (new C.D<C.A<C.B>>(new C.A<C.B>())).val; 85 AssertType((new C.D<C.A<C.B>>(new C.A<C.B>())).val, "C.A<C.B>"); 87 export function f<T extends C.A<C.B>>() { } [all …]
|
D | emitClassDeclarationWithPropertyAccessInHeritageClause1.ts | 21 class B {} 23 AssertType({B: B}, "{ B: typeof B; }"); 24 AssertType(B, "typeof B"); 25 AssertType(B, "typeof B"); 26 return {B: B}; 28 class C extends (foo()).B {}
|
D | emitClassDeclarationWithTypeArgumentAndOverloadInES6.ts | 21 class B<T> { 23 B: T; 27 constructor(a: T) { this.B = a; 28 AssertType(this.B = a, "T"); 30 AssertType(this.B, "T"); 47 AssertType(this.B, "T"); 49 return this.B; 52 this.B = c; 53 AssertType(this.B = c, "T"); 54 AssertType(this.B, "T");
|
D | dottedModuleName2.ts | 21 module A.B { 29 module AA { export module B { 37 let tmpOK = AA.B.x; 39 AssertType(AA.B.x, "number"); 41 let tmpError = A.B.x; 43 AssertType(A.B.x, "number"); 46 module A.B.C 62 import X2 = A.B; 64 import X3 = A.B.C;
|
D | objectLiteralEnumPropertyNames.ts | 24 B = 'b' 29 AssertType({ [Strs.A]: 'xo', [Strs.B]: 'xe'}, "{ a: string; b: string; }"); 36 [Strs.B]: 'xe' 37 AssertType([Strs.B], "string"); 38 AssertType(Strs.B, "Strs.B"); 43 AssertType({ [Strs.A]: 'xo', [Strs.B]: 'xe'}, "{ a: string; b: string; }"); 50 [Strs.B]: 'xe' 51 AssertType([Strs.B], "string"); 52 AssertType(Strs.B, "Strs.B"); 108 B [all …]
|
D | constEnums.ts | 28 B, enumerator 30 D = A | B, 34 H = ~(A | B), 39 M = E << B, 41 O = E >> B, 71 export module B { 75 V2 = A.B.C.E.V1 | 100 82 export module B { 85 V3 = A.B.C.E["V2"] & 200, 86 V4 = A.B.C.E[`V1`] << 1, [all …]
|
D | objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts | 23 class B<U, V> { 38 new(x: X): B<X,Y>; 42 new <Y, Z, A, B>(x: Y): C<Y, Z, A>; 45 let a: { new <Z, A, B, CC, D>(x: Z): C<Z, A, B>; 51 let b = { new<A, B, C, D, E, F>(x: A) { 53 AssertType({ new<A, B, C, D, E, F>(x: A) { return x; } }, "{ new<A, B, C, D, E, F>(A): A; }"); 58 function foo1b(x: B<string, string>); 59 function foo1b(x: B<string, string>); // error 78 function foo8(x: B<string, string>); 82 function foo9(x: B<string, number>); [all …]
|
D | enumClassification.ts | 43 B, enumerator 49 B = 10, enumerator 55 B = "two", enumerator 61 B, enumerator 70 B = "hello", enumerator 72 D = B, 82 B, enumerator 88 B = 1 << 1, 96 B = A + 1,
|
D | asyncAwaitNestedClasses_es5.ts | 23 static B = class B { 36 await B.func2(); 37 AssertType(await B.func2(), "void"); 38 AssertType(B.func2(), "Promise<void>"); 39 AssertType(B.func2, "() => Promise<void>"); 45 A.B.C.func(); 46 AssertType(A.B.C.func(), "Promise<void>"); 47 AssertType(A.B.C.func, "() => Promise<void>");
|
D | funduleExportedClassIsUsedBeforeDeclaration.ts | 22 (): B.C; // uses defined below class in module 24 declare function B(): B.C; // function merged with module function 25 declare module B { 29 new B.C(); 30 AssertType(new B.C(), "B.C"); 31 AssertType(B.C, "typeof B.C");
|
D | genericClasses4.ts | 25 fmap<B>(f: (a: A) => B): Vec2_T<B> { 26 let x:B = f(this.x); 33 let y:B = f(this.y); 40 let retval: Vec2_T<B> = new Vec2_T(x, y); 50 apply<B>(f: Vec2_T<(a: A) => B>): Vec2_T<B> { 51 let x:B = f.x(this.x); 58 let y:B = f.y(this.y); 65 let retval: Vec2_T<B> = new Vec2_T(x, y);
|
D | objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.ts | 30 class B<U, V> { class 49 foo<Y, Z, A, B>(x: Y): Y; 52 let a: { foo<Z, A, B, C, D>(x: Z): Z 60 let b = { foo<A, B, C, D, E, F>(x: A) { 62 AssertType({ foo<A, B, C, D, E, F>(x: A) { return x; } }, "{ foo<A, B, C, D, E, F>(A): A; }"); 72 function foo1b(x: B<string, string>); 73 function foo1b(x: B<string, string>); // error 93 function foo5(x: B<string, string>); // ok 108 function foo8(x: B<string, string>); 112 function foo9(x: B<string, number>); [all …]
|
D | genericClassesInModule2.ts | 23 let child = new B(this); 25 AssertType(new B(this), "B<this>"); 26 AssertType(B, "typeof B"); 30 let child = new B(this); 32 AssertType(new B(this), "B<this>"); 33 AssertType(B, "typeof B"); 39 child: B<T1>; 44 export class B<T2> { class
|
D | interMixingModulesInterfaces1.ts | 23 export interface B { 28 export module B { 29 export function createB(): B { 36 let x: A.B = A.B.createB(); 39 AssertType(A.B.createB(), "A.B"); 40 AssertType(A.B.createB, "() => A.B");
|
D | interMixingModulesInterfaces0.ts | 23 export module B { 24 export function createB(): B { 30 export interface B { 36 let x: A.B = A.B.createB(); 39 AssertType(A.B.createB(), "A.B"); 40 AssertType(A.B.createB, "() => A.B");
|