/arkcompiler/ets_runtime/test/typeinfer/automatedcases/ |
D | nullAssignableToEveryType.ts | 37 let b: number = null; 39 AssertType(null, "null"); 41 let c: string = null; 43 AssertType(null, "null"); 45 let d: boolean = null; 47 AssertType(null, "null"); 49 let e: Date = null; 51 AssertType(null, "null"); 53 let f: any = null; 55 AssertType(null, "null"); [all …]
|
D | nullIsSubtypeOfEverythingButUndefined.ts | 21 // null is a subtype of any other types except undefined 23 let r0 = true ? null : null; 25 AssertType(true ? null : null, "null"); 27 AssertType(null, "null"); 28 AssertType(null, "null"); 30 let r0 = true ? null : null; 32 AssertType(true ? null : null, "null"); 34 AssertType(null, "null"); 35 AssertType(null, "null"); 41 let r0b = true ? u : null; [all …]
|
D | transformsElideNullUndefinedType.ts | 21 let v0: null; 22 AssertType(v0, "null"); 23 AssertType(null, "null"); 28 function f0(): null { 29 AssertType(null, "null"); 30 return null; 38 let f2 = function (): null { 39 AssertType(f2, "() => null"); 40 return null; 42 AssertType(function (): null { return null; }, "() => null"); [all …]
|
D | objectLiteralWidened.ts | 25 AssertType({ foo: null, bar: undefined}, "{ foo: null; bar: undefined; }"); 27 foo: null, 28 AssertType(foo, "null"); 29 AssertType(null, "null"); 38 AssertType({ foo: null, bar: { baz: null, boo: undefined }}, "{ foo: null; b… 40 foo: null, 41 AssertType(foo, "null"); 42 AssertType(null, "null"); 45 AssertType(bar, "{ baz: null; boo: undefined; }"); 46 AssertType({ baz: null, boo: undefined }, "{ baz: null; boo: undefined; }"); [all …]
|
D | destructuringAssignmentWithExportedName.ts | 28 exportedFoo = null; 29 AssertType(exportedFoo = null, "null"); 31 AssertType(null, "null"); 33 nonexportedFoo = null; 34 AssertType(nonexportedFoo = null, "null"); 36 AssertType(null, "null"); 38 if (null as any) { 39 ({ exportedFoo, nonexportedFoo } = null as any); 40 AssertType(({ exportedFoo, nonexportedFoo } = null as any), "any"); 41 AssertType({ exportedFoo, nonexportedFoo } = null as any, "any"); [all …]
|
D | widenedTypes1.ts | 21 let a = null; 23 AssertType(null, "null"); 29 let c = {x: null}; 31 AssertType({x: null}, "{ x: null; }"); 32 AssertType(x, "null"); 33 AssertType(null, "null"); 35 let d = [{x: null}]; 37 AssertType([{x: null}], "{ x: null; }[]"); 38 AssertType({x: null}, "{ x: null; }"); 39 AssertType(x, "null"); [all …]
|
D | initializersWidened.ts | 23 let x1 = null; 25 AssertType(null, "null"); 38 let x2: null; 39 AssertType(x2, "null"); 40 AssertType(null, "null"); 45 let x3: null = null; 46 AssertType(x3, "null"); 47 AssertType(null, "null"); 48 AssertType(null, "null"); 61 let x4 = null || null; [all …]
|
D | nullishCoalescingOperator1.ts | 21 declare const a1: string | undefined | null 23 AssertType(null, "null"); 25 declare const a2: string | undefined | null 27 AssertType(null, "null"); 29 declare const a3: string | undefined | null 31 AssertType(null, "null"); 33 declare const a4: string | undefined | null 35 AssertType(null, "null"); 37 declare const b1: number | undefined | null 39 AssertType(null, "null"); [all …]
|
D | jsDeclarationsReusesExistingNodesMappingJSDocTypes.ts | 22 export const a = null; 24 AssertType(null, "null"); 27 export const b = null; 29 AssertType(null, "null"); 32 export const c = null; 34 AssertType(null, "null"); 37 export const d = null; 39 AssertType(null, "null"); 42 export const e = null; 44 AssertType(null, "null"); [all …]
|
D | genericFunctionsWithOptionalParameters1.ts | 32 utils.fold(null); // no error 33 AssertType(utils.fold(null), "unknown"); 35 AssertType(null, "null"); 37 utils.fold(null, null); // no error 38 AssertType(utils.fold(null, null), "unknown"); 40 AssertType(null, "null"); 41 AssertType(null, "null"); 43 utils.fold(null, null, null); // no error 44 AssertType(utils.fold(null, null, null), "unknown"); 46 AssertType(null, "null"); [all …]
|
D | nullishCoalescingOperator2.ts | 21 declare const a1: 'literal' | undefined | null 23 AssertType(null, "null"); 25 declare const a2: '' | undefined | null 27 AssertType(null, "null"); 29 declare const a3: 1 | undefined | null 31 AssertType(null, "null"); 33 declare const a4: 0 | undefined | null 35 AssertType(null, "null"); 37 declare const a5: true | undefined | null 40 AssertType(null, "null"); [all …]
|
D | nullishCoalescingOperator_not_strict.ts | 21 declare const a1: 'literal' | undefined | null 23 AssertType(null, "null"); 25 declare const a2: '' | undefined | null 27 AssertType(null, "null"); 29 declare const a3: 1 | undefined | null 31 AssertType(null, "null"); 33 declare const a4: 0 | undefined | null 35 AssertType(null, "null"); 37 declare const a5: true | undefined | null 40 AssertType(null, "null"); [all …]
|
D | discriminateObjectTypesOnly.ts | 22 const k: Thing = { toFixed: null }; // OK, satisfies object 24 AssertType({ toFixed: null }, "{ toFixed: null; }"); 25 AssertType(toFixed, "null"); 26 AssertType(null, "null"); 28 type Thing2 = number | { toFixed: null } | object; 29 const q: Thing2 = { toFixed: null }; 31 AssertType({ toFixed: null }, "{ toFixed: null; }"); 32 AssertType(toFixed, "null"); 33 AssertType(null, "null"); 35 const h: Thing2 = { toString: null }; // OK, satisfies object [all …]
|
D | arrayLiteralWidened.ts | 33 let a = [null, null]; 35 AssertType([null, null], "null[]"); 36 AssertType(null, "null"); 37 AssertType(null, "null"); 45 let b = [[], [null, null]]; // any[][] 47 AssertType([[], [null, null]], "undefined[][]"); 49 AssertType([null, null], "null[]"); 50 AssertType(null, "null"); 51 AssertType(null, "null"); 72 let c = [[[null]],[undefined]] [all …]
|
D | typeGuardsNestedAssignments.ts | 25 declare function getFooOrNull(): Foo | null; 26 declare function getStringOrNumberOrNull(): string | number | null; 29 let foo: Foo | null; 31 AssertType(null, "null"); 33 if ((foo = getFooOrNull()) !== null) { 34 AssertType((foo = getFooOrNull()) !== null, "boolean"); 40 AssertType(null, "null"); 48 let foo1: Foo | null; 50 AssertType(null, "null"); 52 let foo2: Foo | null; [all …]
|
D | typeParameterFixingWithConstraints.ts | 32 foo.foo({ bar: null }, bar => null, bar => null); 33 AssertType(foo.foo({ bar: null }, bar => null, bar => null), "{ bar: any; }"); 35 AssertType({ bar: null }, "{ bar: null; }"); 36 AssertType(bar, "null"); 37 AssertType(null, "null"); 38 AssertType(bar => null, "({ bar: any; }) => any"); 40 AssertType(null, "null"); 41 AssertType(bar => null, "({ bar: any; }) => any"); 43 AssertType(null, "null");
|
D | nullishCoalescingOperator3.ts | 21 declare const a1: 'literal' | undefined | null 23 AssertType(null, "null"); 25 declare const a2: '' | undefined | null 27 AssertType(null, "null"); 29 declare const a3: 1 | undefined | null 31 AssertType(null, "null"); 33 declare const a4: 0 | undefined | null 35 AssertType(null, "null"); 37 declare const a5: true | undefined | null 40 AssertType(null, "null"); [all …]
|
D | conditionalOperatorConditoinIsAnyType.ts | 96 null ? exprAny1 : exprAny2; 97 AssertType(null ? exprAny1 : exprAny2, "any"); 98 AssertType(null, "null"); 102 null ? exprBoolean1 : exprBoolean2; 103 AssertType(null ? exprBoolean1 : exprBoolean2, "boolean"); 104 AssertType(null, "null"); 114 [null, undefined] ? exprString1 : exprString2; 115 AssertType([null, undefined] ? exprString1 : exprString2, "string"); 116 AssertType([null, undefined], "null[]"); 117 AssertType(null, "null"); [all …]
|
D | controlFlowOptionalChain2.ts | 49 function funcThree(arg: A | B | null) { 69 type N = { kind: null, n: 'n' } 102 function f3(x: X | U | null) { 108 x; // U | null 117 function f4(x: X | N | null) { 123 x; // null 124 AssertType(x, "null"); 133 if (x?.kind === null) { 134 AssertType(x?.kind === null, "boolean"); 136 AssertType(null, "null"); [all …]
|
D | typeArgInferenceWithNull.ts | 24 fn4(null); 25 AssertType(fn4(null), "void"); 27 AssertType(null, "null"); 30 fn5({ x: null }); 31 AssertType(fn5({ x: null }), "void"); 33 AssertType({ x: null }, "{ x: null; }"); 34 AssertType(x, "null"); 35 AssertType(null, "null"); 38 fn6({ x: null }, y => { }, { x: "" }); // y has type { x: any }, but ideally would have type { x: s… 39 AssertType(fn6({ x: null }, y => { }, { x: "" }), "void"); [all …]
|
D | conditionalExpressions2.ts | 21 let a = false ? 1 : null; 23 AssertType(false ? 1 : null, "int"); 26 AssertType(null, "null"); 56 let f = false ? null : undefined; 58 AssertType(false ? null : undefined, "null"); 60 AssertType(null, "null"); 63 let g = true ? {g:5} : null; 65 AssertType(true ? {g:5} : null, "{ g: number; }"); 70 AssertType(null, "null"); 72 let h = [{h:5}, null]; [all …]
|
/arkcompiler/ets_runtime/test/typeinfer/automatedcases/privacyFunctionReturnTypeDeclFile/ |
D | privacyFunctionReturnTypeDeclFile_externalModule.ts | 57 AssertType(null, "null"); 58 return null; 61 AssertType(null, "null"); 62 return null; 65 AssertType(null, "null"); 66 return null; 69 AssertType(null, "null"); 70 return null; 96 AssertType(null, "null"); 97 return null; [all …]
|
D | privacyFunctionReturnTypeDeclFile_GlobalFile.ts | 31 AssertType(null, "null"); 32 return null; 35 AssertType(null, "null"); 36 return null; 39 AssertType(null, "null"); 40 return null; 43 AssertType(null, "null"); 44 return null; 68 AssertType(null, "null"); 69 return null; [all …]
|
/arkcompiler/ets_runtime/test/typeinfer/automatedcases/privacyAccessorDeclFile/ |
D | privacyAccessorDeclFile_externalModule.ts | 29 AssertType(null, "null"); 30 return null; 33 AssertType(null, "null"); 34 return null; 37 AssertType(null, "null"); 38 return null; 41 AssertType(null, "null"); 42 return null; 68 AssertType(null, "null"); 69 return null; [all …]
|
D | privacyAccessorDeclFile_GlobalFile.ts | 26 AssertType(null, "null"); 27 return null; 30 AssertType(null, "null"); 31 return null; 34 AssertType(null, "null"); 35 return null; 38 AssertType(null, "null"); 39 return null; 89 AssertType(null, "null"); 90 return null; [all …]
|