/arkcompiler/ets_runtime/test/typeinfer/automatedcases/ |
D | uncalledFunctionChecksInConditionalPerf.ts | 21 declare const b: boolean; 22 AssertType(b, "boolean"); 24 …(b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b… 25 …(b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b… 26 …(b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b… 27 …((((b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b) &… 28 …((((b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b) &… 29 …(((((((b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b… 30 …(((((((b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b… 31 …((((((((((b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b) && b) &… [all …]
|
D | arithmeticOperatorWithEnum.ts | 25 b 31 let b: number; variable 32 AssertType(b, "number"); 44 let ra2 = c * b; 46 AssertType(c * b, "number"); 48 AssertType(b, "number"); 62 let ra5 = b * c; 64 AssertType(b * c, "number"); 65 AssertType(b, "number"); 74 let ra7 = E.a * b; [all …]
|
D | arithmeticOperatorWithEnumUnion.ts | 25 b 35 let b: number; variable 36 AssertType(b, "number"); 48 let ra2 = c * b; 50 AssertType(c * b, "number"); 52 AssertType(b, "number"); 66 let ra5 = b * c; 68 AssertType(b * c, "number"); 69 AssertType(b, "number"); 78 let ra7 = E.a * b; [all …]
|
D | arithmeticOperatorWithAnyAndNumber.ts | 24 let b: number; 25 AssertType(b, "number"); 34 let ra2 = a * b; 36 AssertType(a * b, "number"); 38 AssertType(b, "number"); 58 let ra6 = b * 0; 60 AssertType(b * 0, "number"); 61 AssertType(b, "number"); 64 let ra7 = 0 * b; 66 AssertType(0 * b, "number"); [all …]
|
D | comparisonOperatorWithSubtypeObjectOnOptionalProperty.ts | 23 b?: number; 33 let b: J; variable 34 AssertType(b, "J"); 37 let ra1 = a < b; 39 AssertType(a < b, "boolean"); 41 AssertType(b, "J"); 43 let ra2 = b < a; 45 AssertType(b < a, "boolean"); 46 AssertType(b, "J"); 50 let rb1 = a > b; [all …]
|
D | indirectTypeParameterReferences.ts | 23 type B = {b: string} 25 const flowtypes = <A>(b: B) => { 26 AssertType(flowtypes, "<A>(B) => { combined: ((A & B) => void) => any; literal: ((A & B) => void) =… 27 AssertType(b, "B"); 28 …b: B) => { type Combined = A & B const combined = (fn: (combined: Combined) => void) => null co… 30 type Combined = A & B 31 AssertType(Combined, "A & B"); 34 AssertType(combined, "((A & B) => void) => any"); 35 AssertType((fn: (combined: Combined) => void) => null, "((A & B) => void) => any"); 36 AssertType(fn, "(A & B) => void"); [all …]
|
D | comparisonOperatorWithSubtypeEnumAndNumber.ts | 21 enum E { a, b, c } 26 let b: number; variable 27 AssertType(b, "number"); 30 let ra1 = a < b; 32 AssertType(a < b, "boolean"); 34 AssertType(b, "number"); 36 let ra2 = b < a; 38 AssertType(b < a, "boolean"); 39 AssertType(b, "number"); 42 let ra3 = E.a < b; [all …]
|
D | bindingPatternContextualTypeDoesNotCauseWidening.ts | 22 const _ = pick(['b'], { a: 'a', b: 'b' }); // T: "b" 23 AssertType(_, "Pick<{ a: string; b: string; }, "b">"); 24 AssertType(pick(['b'], { a: 'a', b: 'b' }), "Pick<{ a: string; b: string; }, "b">"); 26 AssertType(['b'], ""b"[]"); 27 AssertType('b', "string"); 28 AssertType({ a: 'a', b: 'b' }, "{ a: string; b: string; }"); 31 AssertType(b, "string"); 32 AssertType('b', "string"); 34 const { } = pick(['b'], { a: 'a', b: 'b' }); // T: "b" | "a" ??? (before fix) 35 AssertType(pick(['b'], { a: 'a', b: 'b' }), "Pick<{ a: string; b: string; }, "b">"); [all …]
|
D | newWithSpreadES6.ts | 33 class B { class 38 "a-b": typeof B; 42 1: typeof B; 48 let b: A; variable 49 AssertType(b, "A"); 144 new b.f(1, 2, "string"); 145 AssertType(new b.f(1, 2, "string"), "any"); 146 AssertType(b.f, "new (number, number, ...string[]) => any"); 151 new b.f(1, 2, ...a); 152 AssertType(new b.f(1, 2, ...a), "any"); [all …]
|
D | newWithSpreadES5.ts | 32 class B { class 37 "a-b": typeof B; 41 1: typeof B; 47 let b: A; variable 48 AssertType(b, "A"); 143 new b.f(1, 2, "string"); 144 AssertType(new b.f(1, 2, "string"), "any"); 145 AssertType(b.f, "new (number, number, ...string[]) => any"); 150 new b.f(1, 2, ...a); 151 AssertType(new b.f(1, 2, ...a), "any"); [all …]
|
D | elementAccessChain.ts | 21 declare const o1: undefined | { b: string }; 23 AssertType(b, "string"); 25 o1?.["b"]; 26 AssertType(o1?.["b"], "union"); 28 AssertType("b", "string"); 30 declare const o2: undefined | { b: { c: string } }; 32 AssertType(b, "{ c: string; }"); 35 o2?.["b"].c; 36 AssertType(o2?.["b"].c, "union"); 38 o2?.b["c"]; [all …]
|
D | nullishCoalescingOperator_es2020.ts | 115 declare let a: any, b: any, c: any; 117 AssertType(b, "any"); 120 let x1 = (a ?? b as any) || c; 122 AssertType((a ?? b as any) || c, "any"); 123 AssertType((a ?? b as any), "any"); 124 AssertType(a ?? b as any, "any"); 126 AssertType(b as any, "any"); 127 AssertType(b, "any"); 130 let x2 = c || (a ?? b as any); 132 AssertType(c || (a ?? b as any), "any"); [all …]
|
D | inferenceOfNullableObjectTypesWithCommonBase.ts | 21 function equal<T>(a: T, b: T) { } 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"); [all …]
|
D | enumLiteralTypes2.ts | 45 function f2(a: YesNo, b: UnknownYesNo, c: Choice) { 46 b = a; 47 AssertType(b = a, "YesNo"); 48 AssertType(b, "UnknownYesNo"); 56 c = b; 57 AssertType(c = b, "union"); 59 AssertType(b, "union"); 62 function f3(a: Choice.Yes, b: UnknownYesNo) { 63 let x = a + b; 65 AssertType(a + b, "number"); [all …]
|
D | enumLiteralTypes1.ts | 45 function f2(a: YesNo, b: UnknownYesNo, c: Choice) { 46 b = a; 47 AssertType(b = a, "YesNo"); 48 AssertType(b, "UnknownYesNo"); 56 c = b; 57 AssertType(c = b, "union"); 59 AssertType(b, "union"); 62 function f3(a: Choice.Yes, b: YesNo) { 63 let x = a + b; 65 AssertType(a + b, "number"); [all …]
|
D | binaryArithmeticControlFlowGraphNotTooLarge.ts | 25 …b, c, d, ab, bc, cd, da, blocks = this.blocks; if (this.first) { a = blocks[0] - 1; … 28 let a, b, c, d, ab, bc, cd, da, blocks = this.blocks; 30 AssertType(b, "any"); 135 b = ((c & d) | (~c & a)) + blocks[3] - 271733879; 136 AssertType(b = ((c & d) | (~c & a)) + blocks[3] - 271733879, "number"); 137 AssertType(b, "any"); 156 b = (b << 19) | (b >>> 13); 157 AssertType(b = (b << 19) | (b >>> 13), "number"); 158 AssertType(b, "any"); 159 AssertType((b << 19) | (b >>> 13), "number"); [all …]
|
D | numericLiteralTypes1.ts | 54 let b: B1 = -1; 55 AssertType(b, "B1"); 59 let b: B2 = 0; 60 AssertType(b, "B1"); 63 let b: B3 = 1; 64 AssertType(b, "B1"); 68 function f3(a: 1, b: 0 | 1 | 2) { 69 let x = a + b; 71 AssertType(a + b, "number"); 73 AssertType(b, "union"); [all …]
|
D | numericLiteralTypes2.ts | 54 let b: B1 = -1; 55 AssertType(b, "B1"); 59 let b: B2 = 0; 60 AssertType(b, "B1"); 63 let b: B3 = 1; 64 AssertType(b, "B1"); 68 function f3(a: 1, b: 0 | 1 | 2) { 69 let x = a + b; 71 AssertType(a + b, "number"); 73 AssertType(b, "union"); [all …]
|
D | objectLiteralIndexers.ts | 25 interface B extends A { interface 32 let b: B; variable 33 AssertType(b, "B"); 38 let o1: { [s: string]: A;[n: number]: B; } = { x: a, 0: b }; // string indexer is A, number indexer… 39 AssertType(o1, "{ [string]: A; [number]: B; }"); 42 AssertType({ x: a, 0: b }, "{ x: A; 0: B; }"); 45 AssertType(0, "B"); 46 AssertType(b, "B"); 48 o1 = { x: b, 0: c }; // both indexers are any 49 AssertType(o1 = { x: b, 0: c }, "{ x: B; 0: any; }"); [all …]
|
D | genericClasses4.ts | 25 fmap<B>(f: (a: A) => B): Vec2_T<B> { 26 let x:B = f(this.x); 27 AssertType(x, "B"); 28 AssertType(f(this.x), "B"); 29 AssertType(f, "(A) => B"); 33 let y:B = f(this.y); 34 AssertType(y, "B"); 35 AssertType(f(this.y), "B"); 36 AssertType(f, "(A) => B"); 40 let retval: Vec2_T<B> = new Vec2_T(x, y); [all …]
|
D | jsdocSignatureOnReturnedFunction.ts | 24 * @param {number} b 28 AssertType((a, b) => { return a + b; }, "(number, number) => number"); 30 AssertType(b, "number"); 31 return (a, b) => { 33 AssertType(a + b, "number"); 35 AssertType(b, "number"); 36 return a + b; 43 * @param {number} b 47 AssertType(function (a, b){ return a + b; }, "(number, number) => number"); 49 AssertType(b, "number"); [all …]
|
D | inferenceOptionalProperties.ts | 23 declare let x1: { a?: string, b?: number }; variable 24 AssertType(x1, "{ a?: string; b?: number; }"); 26 AssertType(b, "union"); 28 declare let x2: { a?: string, b?: number | undefined }; variable 29 AssertType(x2, "{ a?: string; b?: union; }"); 31 AssertType(b, "union"); 37 AssertType(x1, "{ a?: string; b?: number; }"); 43 AssertType(x2, "{ a?: string; b?: union; }"); 45 let v1: Required<{ a?: string, b?: number }>; 46 AssertType(v1, "Required<{ a?: string; b?: number; }>"); [all …]
|
D | inferenceOptionalPropertiesStrict.ts | 23 declare let x1: { a?: string, b?: number }; variable 24 AssertType(x1, "{ a?: string; b?: number; }"); 26 AssertType(b, "union"); 28 declare let x2: { a?: string, b?: number | undefined }; variable 29 AssertType(x2, "{ a?: string; b?: union; }"); 31 AssertType(b, "union"); 37 AssertType(x1, "{ a?: string; b?: number; }"); 43 AssertType(x2, "{ a?: string; b?: union; }"); 45 let v1: Required<{ a?: string, b?: number }>; 46 AssertType(v1, "Required<{ a?: string; b?: number; }>"); [all …]
|
D | stringNamedPropertyAccess.ts | 22 "a b": number; 28 let r1 = c["a b"]; 30 AssertType(c["a b"], "number"); 32 AssertType("a b", "string"); 41 "a b": number; 46 let r2 = i["a b"]; 48 AssertType(i["a b"], "number"); 50 AssertType("a b", "string"); 53 AssertType(a, "{ "a b": number; }"); 55 "a b": number; [all …]
|
/arkcompiler/ets_frontend/es2panda/test/parser/js/ |
D | test-binary-expression.js | 17 a | b 18 a ^ b 19 a & b 20 a == b 21 a != b 22 a === b 23 a !== b 24 a < b 25 a <= b 26 a > b [all …]
|