JS: Delete or simplify TypeScript type-specific tests

This commit is contained in:
Asger F
2025-06-02 16:31:46 +02:00
parent ee9c4fa763
commit f5f12c2f81
210 changed files with 10 additions and 10356 deletions

View File

@@ -1,17 +0,0 @@
arrayTypes
| [number, string] | `string \| number` |
| number[] | `number` |
| readonly T[] | `T` |
| readonly number[] | `number` |
| readonly number[][] | `number[]` |
numberIndexTypes
| NumberIndexable | object |
| [number, string] | string \| number |
| number[] | number |
| readonly T[] | T |
| readonly number[] | number |
| readonly number[][] | number[] |
| string | string |
stringIndexTypes
| StringIndexable | object |
tupleTypes

View File

@@ -1,11 +0,0 @@
import javascript
query predicate arrayTypes(ArrayType array, string elem) {
elem = "`" + array.getArrayElementType() + "`"
}
query predicate numberIndexTypes(Type type, Type numType) { type.getNumberIndexType() = numType }
query predicate stringIndexTypes(Type type, Type strType) { type.getStringIndexType() = strType }
query predicate tupleTypes(TupleType type, Type arrType) { arrType = type.getUnderlyingArrayType() }

View File

@@ -1,19 +0,0 @@
let plain: number[];
let readonly: ReadonlyArray<number>;
let tuple: [number, string];
interface NumberIndexable {
length: number;
[n: number]: object;
}
interface StringIndexable {
length: number;
[n: string]: object;
}
let numberIndexable: NumberIndexable;
let stringIndexable: StringIndexable;
let readonlySyntax: readonly number[];
let readonlySyntax2: readonly number[][];

View File

@@ -1,15 +0,0 @@
| CEverything | CGenericBase |
| CEverything | IBase |
| CEverything | IGenericSub |
| CGenericSub | CGenericBase |
| CImplements | IBase |
| CImplementsGeneric | IGenericBase |
| CImplementsString | IGenericBase |
| CStringSub | CGenericBase |
| CSub | CBase |
| IEmptySub | IEmpty |
| IGenericSub | IGenericBase |
| IMulti | IBase |
| IMulti | IGenericBase |
| IStringSub | IGenericBase |
| ISub | IBase |

View File

@@ -1,4 +0,0 @@
import javascript
from TypeName typename
select typename.getName(), typename.getABaseTypeName().getName()

View File

@@ -1,17 +0,0 @@
| CBase | CBase |
| CEverything | CEverything<S, T> |
| CGenericBase | CGenericBase<T> |
| CGenericSub | CGenericSub<Q> |
| CImplements | CImplements |
| CImplementsGeneric | CImplementsGeneric<Q> |
| CImplementsString | CImplementsString |
| CStringSub | CStringSub |
| CSub | CSub |
| IBase | IBase |
| IEmpty | IEmpty |
| IEmptySub | IEmptySub |
| IGenericBase | IGenericBase<T> |
| IGenericSub | IGenericSub<Q> |
| IMulti | IMulti<T> |
| IStringSub | IStringSub |
| ISub | ISub |

View File

@@ -1,4 +0,0 @@
import javascript
from TypeName tn
select tn.getName(), tn.getType()

View File

@@ -1,39 +0,0 @@
interface IBase {
x: string;
}
interface ISub extends IBase {
y: string;
}
interface IGenericBase<T> {
w: T;
}
interface IStringSub extends IGenericBase<string> {}
interface IGenericSub<Q> extends IGenericBase<Q> {}
class CBase {}
class CSub extends CBase {}
class CGenericBase<T> {}
class CStringSub extends CGenericBase<string> {}
class CGenericSub<Q> extends CGenericBase<Q> {}
interface IMulti<T> extends IBase, IGenericBase<T> {}
abstract class CImplements implements IBase {
x: string;
}
abstract class CImplementsString implements IGenericBase<string> {
w: string;
}
abstract class CImplementsGeneric<Q> implements IGenericBase<Q> {
w: Q;
}
abstract class CEverything<S,T> extends CGenericBase<S> implements IGenericSub<T>, IBase {
x: string;
w: T;
}
interface IEmpty {}
interface IEmptySub extends IEmpty {}

View File

@@ -4,14 +4,7 @@ exprFloatValue
| tst.ts:3:25:3:56 | 1000000 ... 000000n | 1.0E30 |
exprIntValue
| tst.ts:1:25:1:28 | 100n | 100 |
exprWithBigIntType
| tst.ts:1:5:1:11 | hundred |
| tst.ts:2:5:2:12 | bigValue |
| tst.ts:3:5:3:20 | bigNegativeValue |
| tst.ts:5:5:5:14 | bigintType |
literalTypeExprIntValue
| tst.ts:6:24:6:28 | 1000n | 1000 |
typeExpr
| tst.ts:5:24:5:29 | bigint |
typeIntValue
| 1000n | 1000 |

View File

@@ -4,12 +4,8 @@ query predicate exprFloatValue(BigIntLiteral literal, float f) { f = literal.get
query predicate exprIntValue(BigIntLiteral literal, int i) { i = literal.getIntValue() }
query predicate exprWithBigIntType(Expr e) { e.getType() instanceof BigIntType }
query predicate literalTypeExprIntValue(BigIntLiteralTypeExpr type, int val) {
val = type.getIntValue()
}
query predicate typeExpr(TypeExpr type) { type.isBigInt() }
query predicate typeIntValue(BigIntLiteralType type, int i) { type.getIntValue() = i }

View File

@@ -1,24 +0,0 @@
| tst.ts:52:3:52:23 | obj.sim ... od(str) | (x: string): number | 0 |
| tst.ts:53:3:53:24 | obj.gen ... od(str) | (x: string): string | 0 |
| tst.ts:54:3:54:24 | obj.gen ... od(num) | (x: number): number | 0 |
| tst.ts:55:3:55:27 | obj.ove ... od(num) | (x: number): number | 0 |
| tst.ts:56:3:56:27 | obj.ove ... od(str) | (x: string): string | 1 |
| tst.ts:57:3:57:26 | obj.ove ... hod([]) | (x: any): any | 2 |
| tst.ts:58:3:58:36 | obj.gen ... ([num]) | (x: number[]): number | 0 |
| tst.ts:59:3:59:39 | obj.gen ... : str}) | (x: Box<string>): string | 1 |
| tst.ts:60:3:60:34 | obj.gen ... od(num) | (x: any): any | 2 |
| tst.ts:64:3:64:23 | obj.sim ... od(str) | (x: string): number | 0 |
| tst.ts:65:3:65:24 | obj.gen ... od(str) | (x: string): string | 0 |
| tst.ts:66:3:66:24 | obj.gen ... od(num) | (x: number): number | 0 |
| tst.ts:67:3:67:27 | obj.ove ... od(num) | (x: number): number | 0 |
| tst.ts:68:3:68:27 | obj.ove ... od(str) | (x: string): string | 1 |
| tst.ts:69:3:69:36 | obj.gen ... ([num]) | (x: number[]): number | 0 |
| tst.ts:70:3:70:39 | obj.gen ... : str}) | (x: Box<string>): string | 1 |
| tst.ts:74:3:74:28 | new Sim ... or(str) | new (x: string): SimpleConstructor | 0 |
| tst.ts:75:3:75:29 | new Gen ... or(str) | new (x: string): GenericConstructor<string> | 0 |
| tst.ts:76:3:76:29 | new Gen ... or(num) | new (x: number): GenericConstructor<number> | 0 |
| tst.ts:77:3:77:37 | new Ove ... m, num) | new (x: number, y: number): OverloadedConstructor | 0 |
| tst.ts:78:3:78:37 | new Ove ... r, str) | new (x: string, y: string): OverloadedConstructor | 1 |
| tst.ts:79:3:79:48 | new Gen ... [str]) | new (x: string[], y: string[]): GenericOverloadedConstructor<string> | 0 |
| tst.ts:80:3:80:54 | new Gen ... : num}) | new (x: Box<number>, y: Box<number>): GenericOverloadedConstructor<nu... | 1 |
| tst.ts:84:10:84:24 | callback("str") | (x: string): U | 0 |

View File

@@ -1,4 +0,0 @@
import javascript
from InvokeExpr invoke
select invoke, invoke.getResolvedSignature(), invoke.getResolvedOverloadIndex()

View File

@@ -1,36 +0,0 @@
| tst.ts:52:3:52:23 | obj.sim ... od(str) | TestInterface.simpleMethod in global scope | simpleM ... number; |
| tst.ts:53:3:53:24 | obj.gen ... od(str) | TestInterface.genericMethod in global scope | generic ... T): T; |
| tst.ts:54:3:54:24 | obj.gen ... od(num) | TestInterface.genericMethod in global scope | generic ... T): T; |
| tst.ts:55:3:55:27 | obj.ove ... od(num) | TestInterface.overloadedMethod in global scope | overloa ... ): any; |
| tst.ts:55:3:55:27 | obj.ove ... od(num) | TestInterface.overloadedMethod in global scope | overloa ... number; |
| tst.ts:55:3:55:27 | obj.ove ... od(num) | TestInterface.overloadedMethod in global scope | overloa ... string; |
| tst.ts:56:3:56:27 | obj.ove ... od(str) | TestInterface.overloadedMethod in global scope | overloa ... ): any; |
| tst.ts:56:3:56:27 | obj.ove ... od(str) | TestInterface.overloadedMethod in global scope | overloa ... number; |
| tst.ts:56:3:56:27 | obj.ove ... od(str) | TestInterface.overloadedMethod in global scope | overloa ... string; |
| tst.ts:57:3:57:26 | obj.ove ... hod([]) | TestInterface.overloadedMethod in global scope | overloa ... ): any; |
| tst.ts:57:3:57:26 | obj.ove ... hod([]) | TestInterface.overloadedMethod in global scope | overloa ... number; |
| tst.ts:57:3:57:26 | obj.ove ... hod([]) | TestInterface.overloadedMethod in global scope | overloa ... string; |
| tst.ts:58:3:58:36 | obj.gen ... ([num]) | TestInterface.genericOverloadedMethod in global scope | generic ... ): any; |
| tst.ts:58:3:58:36 | obj.gen ... ([num]) | TestInterface.genericOverloadedMethod in global scope | generic ... T>): T; |
| tst.ts:58:3:58:36 | obj.gen ... ([num]) | TestInterface.genericOverloadedMethod in global scope | generic ... []): T; |
| tst.ts:59:3:59:39 | obj.gen ... : str}) | TestInterface.genericOverloadedMethod in global scope | generic ... ): any; |
| tst.ts:59:3:59:39 | obj.gen ... : str}) | TestInterface.genericOverloadedMethod in global scope | generic ... T>): T; |
| tst.ts:59:3:59:39 | obj.gen ... : str}) | TestInterface.genericOverloadedMethod in global scope | generic ... []): T; |
| tst.ts:60:3:60:34 | obj.gen ... od(num) | TestInterface.genericOverloadedMethod in global scope | generic ... ): any; |
| tst.ts:60:3:60:34 | obj.gen ... od(num) | TestInterface.genericOverloadedMethod in global scope | generic ... T>): T; |
| tst.ts:60:3:60:34 | obj.gen ... od(num) | TestInterface.genericOverloadedMethod in global scope | generic ... []): T; |
| tst.ts:64:3:64:23 | obj.sim ... od(str) | TestClass.simpleMethod in global scope | simpleM ... ength } |
| tst.ts:65:3:65:24 | obj.gen ... od(str) | TestClass.genericMethod in global scope | generic ... rn x; } |
| tst.ts:66:3:66:24 | obj.gen ... od(num) | TestClass.genericMethod in global scope | generic ... rn x; } |
| tst.ts:67:3:67:27 | obj.ove ... od(num) | TestClass.overloadedMethod in global scope | overloa ... number; |
| tst.ts:67:3:67:27 | obj.ove ... od(num) | TestClass.overloadedMethod in global scope | overloa ... rn x; } |
| tst.ts:67:3:67:27 | obj.ove ... od(num) | TestClass.overloadedMethod in global scope | overloa ... string; |
| tst.ts:68:3:68:27 | obj.ove ... od(str) | TestClass.overloadedMethod in global scope | overloa ... number; |
| tst.ts:68:3:68:27 | obj.ove ... od(str) | TestClass.overloadedMethod in global scope | overloa ... rn x; } |
| tst.ts:68:3:68:27 | obj.ove ... od(str) | TestClass.overloadedMethod in global scope | overloa ... string; |
| tst.ts:69:3:69:36 | obj.gen ... ([num]) | TestClass.genericOverloadedMethod in global scope | generic ... T>): T; |
| tst.ts:69:3:69:36 | obj.gen ... ([num]) | TestClass.genericOverloadedMethod in global scope | generic ... []): T; |
| tst.ts:69:3:69:36 | obj.gen ... ([num]) | TestClass.genericOverloadedMethod in global scope | generic ... null; } |
| tst.ts:70:3:70:39 | obj.gen ... : str}) | TestClass.genericOverloadedMethod in global scope | generic ... T>): T; |
| tst.ts:70:3:70:39 | obj.gen ... : str}) | TestClass.genericOverloadedMethod in global scope | generic ... []): T; |
| tst.ts:70:3:70:39 | obj.gen ... : str}) | TestClass.genericOverloadedMethod in global scope | generic ... null; } |

View File

@@ -1,11 +0,0 @@
import javascript
string getTarget(InvokeExpr e) {
result = e.getResolvedCallee().toString()
or
not exists(e.getResolvedCallee()) and
result = "no concrete target"
}
from InvokeExpr invoke
select invoke, invoke.getResolvedCalleeName(), getTarget(invoke)

View File

@@ -1,85 +0,0 @@
interface Box<T> { x: T }
interface TestInterface {
simpleMethod(x: string): number;
genericMethod<T>(x: T): T;
overloadedMethod(x: number): number;
overloadedMethod(x: string): string;
overloadedMethod(x: any): any;
genericOverloadedMethod<T>(x: T[]): T;
genericOverloadedMethod<T>(x: Box<T>): T;
genericOverloadedMethod(x: any): any;
}
class TestClass {
simpleMethod(x: string): number { return x.length }
genericMethod<T>(x: T): T { return x; }
overloadedMethod(x: number): number;
overloadedMethod(x: string): string;
overloadedMethod(x: any): any { return x; }
genericOverloadedMethod<T>(x: T[]): T;
genericOverloadedMethod<T>(x: Box<T>): T;
genericOverloadedMethod(x: any): any { return x.x || x[0] || null; }
}
class SimpleConstructor {
constructor(x: string) {}
}
class GenericConstructor<T> {
constructor(x: T) {}
}
class OverloadedConstructor {
constructor(x: number, y: number);
constructor(x: string, y: string);
constructor(x: any, y: any) {}
}
class GenericOverloadedConstructor<T> {
constructor(x: T[], y: T[]);
constructor(x: Box<T>, y: Box<T>);
constructor(x: any, y: any) {}
}
function useTestInterface(obj: TestInterface, str: string, num: number) {
obj.simpleMethod(str);
obj.genericMethod(str);
obj.genericMethod(num);
obj.overloadedMethod(num);
obj.overloadedMethod(str);
obj.overloadedMethod([]);
obj.genericOverloadedMethod([num]);
obj.genericOverloadedMethod({x: str});
obj.genericOverloadedMethod(num);
}
function useTestClass(obj: TestClass, str: string, num: number) {
obj.simpleMethod(str);
obj.genericMethod(str);
obj.genericMethod(num);
obj.overloadedMethod(num);
obj.overloadedMethod(str);
obj.genericOverloadedMethod([num]);
obj.genericOverloadedMethod({x: str});
}
function testConstructors(str: string, num: number) {
new SimpleConstructor(str);
new GenericConstructor(str);
new GenericConstructor(num);
new OverloadedConstructor(num, num);
new OverloadedConstructor(str, str);
new GenericOverloadedConstructor([str], [str]);
new GenericOverloadedConstructor({x: num}, {x: num});
}
function testCallback<U>(callback: (x: string) => U): U {
return callback("str");
}

View File

@@ -1,131 +0,0 @@
test_ExprSignature
| tst.ts:2:4:2:4 | x | number |
| tst.ts:6:4:6:4 | x | number |
| tst.ts:7:4:7:4 | x | string |
| tst.ts:8:4:8:4 | x | any |
| tst.ts:12:8:12:8 | x | number |
| tst.ts:16:8:16:8 | x | number |
| tst.ts:17:8:17:8 | x | any |
| tst.ts:21:3:21:28 | method( ... string; | (x: number): string |
| tst.ts:21:10:21:10 | x | number |
| tst.ts:23:3:23:38 | overloa ... number; | (x: any): any |
| tst.ts:23:3:23:38 | overloa ... number; | (x: number): number |
| tst.ts:23:3:23:38 | overloa ... number; | (x: string): string |
| tst.ts:23:20:23:20 | x | number |
| tst.ts:24:3:24:38 | overloa ... string; | (x: any): any |
| tst.ts:24:3:24:38 | overloa ... string; | (x: number): number |
| tst.ts:24:3:24:38 | overloa ... string; | (x: string): string |
| tst.ts:24:20:24:20 | x | string |
| tst.ts:25:3:25:32 | overloa ... ): any; | (x: any): any |
| tst.ts:25:3:25:32 | overloa ... ): any; | (x: number): number |
| tst.ts:25:3:25:32 | overloa ... ): any; | (x: string): string |
| tst.ts:25:20:25:20 | x | any |
| tst.ts:28:5:28:5 | m | Method |
| tst.ts:29:1:29:1 | m | Method |
| tst.ts:29:1:29:8 | m.method | (x: number): string |
| tst.ts:29:1:29:12 | m.method(42) | string |
| tst.ts:29:10:29:11 | 42 | 42 |
| tst.ts:30:1:30:1 | m | Method |
| tst.ts:30:1:30:18 | m.overloadedMethod | (x: any): any |
| tst.ts:30:1:30:18 | m.overloadedMethod | (x: number): number |
| tst.ts:30:1:30:18 | m.overloadedMethod | (x: string): string |
| tst.ts:30:1:30:25 | m.overl ... ("foo") | string |
| tst.ts:30:20:30:24 | "foo" | "foo" |
| tst.ts:33:3:33:10 | callback | (x: number): string |
| tst.ts:33:13:33:33 | (x: num ... string | (x: number): string |
| tst.ts:33:14:33:14 | x | number |
| tst.ts:37:3:37:18 | method(x: T): T; | (x: T): T |
| tst.ts:37:10:37:10 | x | T |
| tst.ts:40:10:40:12 | foo | (g: Generic<string>): string |
| tst.ts:40:14:40:14 | g | Generic<string> |
| tst.ts:41:10:41:10 | g | Generic<string> |
| tst.ts:41:10:41:17 | g.method | (x: string): string |
| tst.ts:41:10:41:24 | g.method("foo") | string |
| tst.ts:41:19:41:23 | "foo" | "foo" |
| tst.ts:44:15:44:15 | C | C |
| tst.ts:45:3:45:25 | constru ... tring); | any |
| tst.ts:45:15:45:15 | x | string |
| tst.ts:46:3:46:25 | constru ... umber); | any |
| tst.ts:46:15:46:15 | x | number |
| tst.ts:50:3:50:36 | method( ... ing[]); | (x: number, ...y: string[]): any |
| tst.ts:50:10:50:10 | x | number |
| tst.ts:50:24:50:24 | y | string[] |
| tst.ts:51:4:51:4 | x | number |
| tst.ts:51:18:51:18 | y | string[] |
| tst.ts:52:7:52:7 | x | number |
| tst.ts:52:21:52:21 | y | string[] |
| tst.ts:54:3:54:34 | method2 ... ing[]); | (x: number, y: string[]): any |
| tst.ts:54:11:54:11 | x | number |
| tst.ts:54:22:54:22 | y | string[] |
| tst.ts:55:3:55:32 | method3 ... tring); | (x: number, y: string): any |
| tst.ts:55:11:55:11 | x | number |
| tst.ts:55:22:55:22 | y | string |
| tst.ts:59:3:59:25 | method( ... ing[]); | (...y: string[]): any |
| tst.ts:59:13:59:13 | y | string[] |
| tst.ts:60:7:60:7 | y | string[] |
| tst.ts:61:10:61:10 | y | string[] |
| tst.ts:63:3:63:23 | method2 ... ing[]); | (y: string[]): any |
| tst.ts:63:11:63:11 | y | string[] |
| tst.ts:64:3:64:21 | method3(y: string); | (y: string): any |
| tst.ts:64:11:64:11 | y | string |
test_TypeReferenceSig
| Callable | function | 0 | (x: number): string |
| Newable | constructor | 0 | new (x: number): any |
| OnlyRestParams | constructor | 0 | new (...y: string[]): any |
| OnlyRestParams | function | 0 | (...y: string[]): any |
| OverloadedCallable | function | 0 | (x: number): number |
| OverloadedCallable | function | 1 | (x: string): string |
| OverloadedCallable | function | 2 | (x: any): any |
| OverloadedNewable | constructor | 0 | new (x: number): OverloadedNewable |
| OverloadedNewable | constructor | 1 | new (x: any): any |
| WithRestParams | constructor | 0 | new (x: number, ...y: string[]): any |
| WithRestParams | function | 0 | (x: number, ...y: string[]): any |
test_FunctionCallSig
| tst.ts:2:3:2:22 | (x: number): string; | (x: number): string |
| tst.ts:6:3:6:22 | (x: number): number; | (x: number): number |
| tst.ts:7:3:7:22 | (x: string): string; | (x: string): string |
| tst.ts:8:3:8:16 | (x: any): any; | (x: any): any |
| tst.ts:12:3:12:23 | new (x: ... ): any; | new (x: number): any |
| tst.ts:16:3:16:37 | new (x: ... ewable; | new (x: number): OverloadedNewable |
| tst.ts:17:3:17:20 | new (x: any): any; | new (x: any): any |
| tst.ts:21:3:21:28 | method( ... string; | (x: number): string |
| tst.ts:23:3:23:38 | overloa ... number; | (x: number): number |
| tst.ts:24:3:24:38 | overloa ... string; | (x: string): string |
| tst.ts:25:3:25:32 | overloa ... ): any; | (x: any): any |
| tst.ts:33:13:33:33 | (x: num ... string | (x: number): string |
| tst.ts:37:3:37:18 | method(x: T): T; | (x: T): T |
| tst.ts:40:1:42:1 | functio ... oo");\\n} | (g: Generic<string>): string |
| tst.ts:45:3:45:25 | constru ... tring); | new (x: string): C |
| tst.ts:46:3:46:25 | constru ... umber); | new (x: number): C |
| tst.ts:50:3:50:36 | method( ... ing[]); | (x: number, ...y: string[]): any |
| tst.ts:51:3:51:30 | (x: num ... ing[]); | (x: number, ...y: string[]): any |
| tst.ts:52:3:52:33 | new(x: ... ing[]); | new (x: number, ...y: string[]): any |
| tst.ts:54:3:54:34 | method2 ... ing[]); | (x: number, y: string[]): any |
| tst.ts:55:3:55:32 | method3 ... tring); | (x: number, y: string): any |
| tst.ts:59:3:59:25 | method( ... ing[]); | (...y: string[]): any |
| tst.ts:60:3:60:19 | (...y: string[]); | (...y: string[]): any |
| tst.ts:61:3:61:22 | new(...y: string[]); | new (...y: string[]): any |
| tst.ts:63:3:63:23 | method2 ... ing[]); | (y: string[]): any |
| tst.ts:64:3:64:21 | method3(y: string); | (y: string): any |
test_getRestParameterType
| (...y: string[]): any | string |
| (x: number, ...y: string[]): any | string |
| new (...y: string[]): any | string |
| new (x: number, ...y: string[]): any | string |
test_getRestParameterArray
| (...y: string[]): any | string[] |
| (x: number, ...y: string[]): any | string[] |
| new (...y: string[]): any | string[] |
| new (x: number, ...y: string[]): any | string[] |
test_RestSig_getParameter
| (...y: string[]): any | 0 | y | string |
| (x: number, ...y: string[]): any | 0 | x | number |
| (x: number, ...y: string[]): any | 1 | y | string |
| new (...y: string[]): any | 0 | y | string |
| new (x: number, ...y: string[]): any | 0 | x | number |
| new (x: number, ...y: string[]): any | 1 | y | string |
test_RestSig_numRequiredParams
| (...y: string[]): any | 0 |
| (x: number, ...y: string[]): any | 1 |
| new (...y: string[]): any | 0 |
| new (x: number, ...y: string[]): any | 1 |

View File

@@ -1,41 +0,0 @@
import javascript
string getASignatureOrElseType(Type t) {
result = t.getASignature(_).toString()
or
not exists(t.getASignature(_)) and
result = t.toString()
}
query predicate test_ExprSignature(Expr expr, string type) {
not exists(MethodDeclaration decl | decl.getNameExpr() = expr) and
not exists(DotExpr dot | expr = dot.getPropertyNameExpr()) and
type = getASignatureOrElseType(expr.getType())
}
query predicate test_TypeReferenceSig(
TypeReference type, SignatureKind kind, int n, CallSignatureType sig
) {
sig = type.getSignature(kind, n)
}
query predicate test_FunctionCallSig(Function f, CallSignatureType sig) {
sig = f.getCallSignature()
}
query Type test_getRestParameterType(CallSignatureType sig) { result = sig.getRestParameterType() }
query Type test_getRestParameterArray(CallSignatureType sig) {
result = sig.getRestParameterArrayType()
}
query predicate test_RestSig_getParameter(CallSignatureType sig, int n, string name, Type type) {
sig.hasRestParameter() and
name = sig.getParameterName(n) and
type = sig.getParameter(n)
}
query int test_RestSig_numRequiredParams(CallSignatureType sig) {
sig.hasRestParameter() and
result = sig.getNumRequiredParameter()
}

View File

@@ -1,65 +0,0 @@
interface Callable {
(x: number): string;
}
interface OverloadedCallable {
(x: number): number;
(x: string): string;
(x: any): any;
}
interface Newable {
new (x: number): any;
}
interface OverloadedNewable {
new (x: number): OverloadedNewable;
new (x: any): any;
}
interface Method {
method(x: number): string;
overloadedMethod(x: number): number;
overloadedMethod(x: string): string;
overloadedMethod(x: any): any;
}
let m: Method;
m.method(42);
m.overloadedMethod("foo");
interface FunctionTypeField {
callback: (x: number) => string;
}
interface Generic<T> {
method(x: T): T;
}
function foo(g: Generic<string>) {
return g.method("foo");
}
declare class C {
constructor(x: string);
constructor(x: number);
}
interface WithRestParams {
method(x: number, ...y: string[]);
(x: number, ...y: string[]);
new(x: number, ...y: string[]);
method2(x: number, y: string[]);
method3(x: number, y: string);
}
interface OnlyRestParams {
method(...y: string[]);
(...y: string[]);
new(...y: string[]);
method2(y: string[]);
method3(y: string);
}

View File

@@ -1,8 +0,0 @@
| client1.ts:4:9:4:19 | F.Component | Component in module 'framework1' |
| client1.ts:5:9:5:29 | Util.De ... mponent | Util.DefaultComponent in global scope |
| client2.ts:4:9:4:19 | F.Component | Component in module 'framework2' |
| client2.ts:5:9:5:30 | Util2.D ... mponent | Util2.DefaultComponent in global scope |
| client2_lazy.ts:4:9:4:19 | F.Component | Component in module 'framework2' |
| client2_lazy.ts:5:9:5:30 | Util2.D ... mponent | Util2.DefaultComponent in global scope |
| declare-module-client2.ts:5:8:5:8 | C | C in module 'foo' |
| declare-module-client.ts:5:8:5:8 | C | C in module 'foo' |

View File

@@ -1,4 +0,0 @@
import javascript
from TypeAccess access
select access, access.getTypeName()

View File

@@ -1,34 +1,6 @@
classDeclaration
| test.vue:3:18:5:3 | class M ... er;\\n } |
| test_tsx.vue:3:18:5:3 | class M ... er;\\n } |
exprType
| htmlfile.html:4:22:4:24 | foo | () => void |
| htmlfile.html:4:33:4:41 | "./other" | any |
| htmlfile.html:5:17:5:22 | result | number[] |
| htmlfile.html:5:26:5:28 | foo | () => void |
| htmlfile.html:5:26:5:30 | foo() | void |
| htmlfile.html:5:26:5:42 | foo() as number[] | number[] |
| other.ts:1:8:1:16 | Component | typeof default in test.vue |
| other.ts:1:23:1:34 | "./test.vue" | any |
| other.ts:2:8:2:19 | ComponentTsx | typeof default in test_tsx.vue |
| other.ts:2:26:2:41 | "./test_tsx.vue" | any |
| other.ts:4:1:4:15 | new Component() | MyComponent |
| other.ts:4:5:4:13 | Component | typeof default in test.vue |
| other.ts:5:1:5:18 | new ComponentTsx() | MyComponentTsx |
| other.ts:5:5:5:16 | ComponentTsx | typeof default in test_tsx.vue |
| other.ts:7:17:7:19 | foo | () => void |
| test.vue:2:15:2:19 | other | typeof other.ts |
| test.vue:2:26:2:34 | "./other" | any |
| test.vue:3:24:3:34 | MyComponent | MyComponent |
| test.vue:4:7:4:7 | x | number |
| test_tsx.vue:2:15:2:19 | other | typeof other.ts |
| test_tsx.vue:2:26:2:34 | "./other" | any |
| test_tsx.vue:3:24:3:37 | MyComponentTsx | MyComponentTsx |
| test_tsx.vue:4:7:4:7 | x | number |
symbols
| other.ts:1:1:8:0 | <toplevel> | other.ts |
| test.vue:2:3:6:0 | <toplevel> | test.vue |
| test_tsx.vue:2:3:6:0 | <toplevel> | test_tsx.vue |
importTarget
| htmlfile.html:4:13:4:42 | import ... other"; | other.ts:1:1:8:0 | <toplevel> |
| other.ts:1:1:1:35 | import ... t.vue"; | test.vue:2:3:6:0 | <toplevel> |

View File

@@ -2,8 +2,4 @@ import javascript
query ClassDefinition classDeclaration() { any() }
query Type exprType(Expr e) { result = e.getType() }
query predicate symbols(Module mod, CanonicalName name) { ast_node_symbol(mod, name) }
query predicate importTarget(Import imprt, Module mod) { imprt.getImportedModule() = mod }

View File

@@ -1,77 +0,0 @@
| After |
| AfterX |
| Before |
| BeforeX |
| Box<Expand<T[]>> |
| Box<S> |
| Box<S> |
| Box<T[]> |
| Box<number> |
| C<T> |
| C<T[]> |
| Expand<T> |
| Expand<T[]> |
| ExpandUsingObjectLiteral<T> |
| ExpandUsingObjectLiteral<T[]> |
| Expansive<T> |
| Expansive<T> |
| Expansive<T[]> |
| Expansive<T[]> |
| Expansive<number> |
| Expansive<string> |
| ExpansiveA<S> |
| ExpansiveA<S> |
| ExpansiveA<T> |
| ExpansiveA<T> |
| ExpansiveB<S> |
| ExpansiveB<S> |
| ExpansiveB<T> |
| ExpansiveB<T[]> |
| ExpansiveB<T[]> |
| ExpansiveB<number> |
| ExpansiveByInference<T> |
| ExpansiveByInference<T[]> |
| ExpansiveC<T> |
| ExpansiveC<T> |
| ExpansiveC<T> |
| ExpansiveC<T[]> |
| ExpansiveC<T[]> |
| ExpansiveC<number> |
| ExpansiveConstructSignature<T> |
| ExpansiveConstructSignature<T[]> |
| ExpansiveD<T> |
| ExpansiveD<T> |
| ExpansiveD<T> |
| ExpansiveD<T> |
| ExpansiveFunctionType<T> |
| ExpansiveFunctionType<T[]> |
| ExpansiveMethod<T> |
| ExpansiveMethod<T[]> |
| ExpansiveParameter<T> |
| ExpansiveParameter<T[]> |
| ExpansiveSignature<T> |
| ExpansiveSignature<T[]> |
| ExpansiveSignatureTypeBound<T> |
| ExpansiveSignatureTypeBound<T[]> |
| ExpansiveX<T> |
| ExpansiveX<T[]> |
| NonExpansive<Box<number>> |
| NonExpansive<T> |
| T[] |
| T[] |
| T[] |
| T[] |
| T[] |
| T[] |
| T[] |
| T[] |
| T[] |
| T[] |
| T[] |
| T[] |
| T[] |
| T[] |
| T[] |
| T[] |
| T[] |
| T[] |

View File

@@ -1,4 +0,0 @@
import javascript
from TypeReference type
select type

View File

@@ -1 +0,0 @@
export let x = 1;

View File

@@ -1,8 +0,0 @@
import * as dummy from "./dummy";
class ExpansiveByInference<T> {
x: T;
y = new ExpansiveByInference([this.x]); // Inferred to be `ExpansiveByInference<T[]>`
constructor(arg: T) {}
}

View File

@@ -1,5 +0,0 @@
import * as dummy from "./dummy";
class C<T> {
x: C<T[]>;
}

View File

@@ -1,7 +0,0 @@
import * as dummy from "./dummy";
interface ExpandUsingObjectLiteral<T> {
x: {
foo: ExpandUsingObjectLiteral<T[]>
}
}

View File

@@ -1,25 +0,0 @@
import * as dummy from "./dummy";
interface ExpansiveSignature<T> {
x: { (): ExpansiveSignature<T[]>; }
}
interface ExpansiveParameter<T> {
x: { (param: ExpansiveParameter<T[]>): void; }
}
interface ExpansiveConstructSignature<T> {
x: { new(): ExpansiveConstructSignature<T[]>; }
}
interface ExpansiveMethod<T> {
method(): ExpansiveMethod<T[]>;
}
interface ExpansiveFunctionType<T> {
x: () => ExpansiveFunctionType<T[]>;
}
interface ExpansiveSignatureTypeBound<T> {
foo : { <G extends ExpansiveSignatureTypeBound<T[]>>(x: G): G };
}

View File

@@ -1,13 +0,0 @@
import * as dummy from "./dummy";
interface Before {
x: Expansive<number>;
}
interface Expansive<T> {
x: Expansive<T[]>;
}
interface After {
x: Expansive<string>;
}

View File

@@ -1,17 +0,0 @@
import * as dummy from "./dummy";
interface ExpansiveA<T> {
x: ExpansiveB<T[]>;
}
interface ExpansiveB<S> {
x: ExpansiveA<S>;
}
interface ExpansiveC<T> {
x: ExpansiveD<T>;
}
interface ExpansiveD<T> {
x: ExpansiveC<T[]>;
}

View File

@@ -1,24 +0,0 @@
import * as dummy from "./dummy";
// The expansive edge may be preceded by non-expansive edges.
interface ExpansiveA<T> {
a: ExpansiveB<T>;
b: ExpansiveB<number>;
x: ExpansiveB<T[]>;
}
interface ExpansiveB<S> {
x: ExpansiveA<S>;
}
interface ExpansiveC<T> {
x: ExpansiveD<T>;
}
interface ExpansiveD<T> {
a: ExpansiveC<T>;
b: ExpansiveC<number>;
x: ExpansiveC<T[]>;
}

View File

@@ -1,12 +0,0 @@
import * as dummy from "./dummy";
// Box is not expansive by itself but expansions may go "through" it.
interface Box<S> {
x: S;
}
// A too simple algorithm might classify this as expansive.
interface NonExpansive<T> {
x: NonExpansive<Box<number>>;
y: Box<T[]>;
}

View File

@@ -1,5 +0,0 @@
import * as dummy from "./dummy";
interface Expansive<T> {
x: Expansive<T[]>;
}

View File

@@ -1,10 +0,0 @@
import * as dummy from "./dummy";
interface Expand<T> {
x: Box<Expand<T[]>>
}
// Box is not expansive by itself but expansions may go "through" it.
interface Box<S> {
x: S;
}

View File

@@ -1,15 +0,0 @@
import * as dummy from "./dummy";
interface BeforeX {
x: number;
}
interface ExpansiveX<T> {
a: BeforeX;
x: ExpansiveX<T[]>;
b: BeforeX;
}
interface AfterX {
x: string;
}

View File

@@ -1,3 +0,0 @@
| B in module 'mylib' | A in module 'mylib' |
| C in module 'mylib' | B in module 'mylib' |
| D in module 'mylib' | C in module 'mylib' |

View File

@@ -1,5 +0,0 @@
import javascript
from TypeName tn
where tn.hasQualifiedName("mylib", _)
select tn, tn.getABaseTypeName()

View File

@@ -1,4 +0,0 @@
export interface A {}
export interface B extends A {}
export interface C extends B {}
export interface D extends C {}

View File

@@ -1 +0,0 @@
semmle-extractor-options:--exclude node_modules/**

View File

@@ -1,5 +0,0 @@
{
"compilerOptions": {
"baseUrl": "./"
}
}

View File

@@ -1,3 +0,0 @@
import { D } from "mylib";
export var foo: D = null;

View File

@@ -1,9 +0,0 @@
import { ExternalType1, Augmentation } from "esmodule";
declare module "esmodule" {
export interface Augmentation {
x: ExternalType1;
}
}
let x: Augmentation;

View File

@@ -1,16 +0,0 @@
import { ExternalType1, externalSymbol } from "esmodule";
function f(arg: ExternalType1) {
let y = arg.x; // y should be ExternalType2
}
let foo = 5;
let bar: { x: number };
interface InternalType {
x: number;
[externalSymbol]: number;
}
let symb = externalSymbol;

View File

@@ -1,7 +0,0 @@
import { OtherClass } from "esmodule/otherfile";
import { UtilClass } from "esmodule/util";
import { UtilExtraClass } from "esmodule/util/extra";
let c1 = new OtherClass();
let c2 = new UtilClass();
let c3 = new UtilExtraClass();

View File

@@ -1,3 +0,0 @@
/// <reference types="legacy"/>
let d = new LegacyGlobals.LegacySubclass();

View File

@@ -1,3 +0,0 @@
import { LegacyClass } from "legacy";
let c: LegacyClass;

View File

@@ -1,3 +0,0 @@
/// <reference types="modern"/>
let d = new ModernGlobals.ModernSubclass();

View File

@@ -1,3 +0,0 @@
import { ModernClass } from "modern";
let c: ModernClass;

View File

@@ -1,10 +0,0 @@
export interface ExternalType1 {
x: ExternalType2;
}
export interface ExternalType2 {
x: number;
y: number;
}
export const externalSymbol: unique symbol;

View File

@@ -1 +0,0 @@
export declare class OtherClass {}

View File

@@ -1 +0,0 @@
export declare class UtilExtraClass {}

View File

@@ -1 +0,0 @@
export declare class UtilClass {}

View File

@@ -1,13 +0,0 @@
declare namespace __Legacy {
export class LegacyClass {}
}
declare module "legacy" {
export = __Legacy;
}
declare namespace LegacyGlobals {
import Legacy = __Legacy;
class LegacySubclass extends Legacy.LegacyClass {}
}

View File

@@ -1,12 +0,0 @@
export = Modern;
export as namespace Modern;
declare namespace Modern {
class ModernClass {}
}
declare global {
namespace ModernGlobals {
class ModernSubclass extends Modern.ModernClass {}
}
}

View File

@@ -1 +0,0 @@
semmle-extractor-options:--exclude node_modules/**

View File

@@ -1,28 +0,0 @@
globalQualifiedNames
| LegacyClass | __Legacy.LegacyClass |
| LegacySubclass | LegacyGlobals.LegacySubclass |
| ModernClass | Modern.ModernClass |
| ModernSubclass | ModernGlobals.ModernSubclass |
moduleQualifiedName
| Augmentation | esmodule | Augmentation |
| ExternalType1 | esmodule | ExternalType1 |
| ExternalType2 | esmodule | ExternalType2 |
| LegacyClass | legacy | LegacyClass |
| ModernClass | modern | ModernClass |
| OtherClass | esmodule/otherfile | OtherClass |
| UtilClass | esmodule/util | UtilClass |
| UtilExtraClass | esmodule/util/extra | UtilExtraClass |
types
| Augmentation | defined in augmentation.ts |
| ExternalType1 | has no definition |
| ExternalType2 | has no definition |
| InternalType | defined in client_esmodule.ts |
| LegacyClass | has no definition |
| LegacySubclass | has no definition |
| ModernClass | has no definition |
| ModernSubclass | has no definition |
| OtherClass | has no definition |
| UtilClass | has no definition |
| UtilExtraClass | has no definition |
uniqueSymbols
| typeof externalSymbol | esmodule | externalSymbol |

View File

@@ -1,26 +0,0 @@
import javascript
query predicate globalQualifiedNames(TypeReference type, string globalName) {
type.hasQualifiedName(globalName) and
not type.hasTypeArguments()
}
query predicate moduleQualifiedName(TypeReference type, string moduleName, string exportedName) {
type.hasQualifiedName(moduleName, exportedName) and
not type.hasTypeArguments()
}
string getDefinition(TypeReference ref) {
if exists(ref.getADefinition())
then result = "defined in " + ref.getADefinition().getFile().getBaseName()
else result = "has no definition"
}
query predicate types(TypeReference type, string def) {
not type.hasTypeArguments() and
def = getDefinition(type)
}
query predicate uniqueSymbols(UniqueSymbolType symbol, string moduleName, string exportedName) {
symbol.hasQualifiedName(moduleName, exportedName)
}

View File

@@ -1,5 +0,0 @@
{
"compilerOptions": {
"baseUrl": "./"
}
}

View File

@@ -1,10 +0,0 @@
#select
| foo.ts:3:12:3:12 | x | foo.Bar in unknown scope |
| foo.ts:4:10:4:10 | x | foo.Bar in unknown scope |
| tst.ts:8:14:8:16 | arg | Base in global scope |
| tst.ts:8:14:8:16 | arg | Sub in global scope |
underlyingTypeNode
| foo | | file://:0:0:0:0 | use moduleImport("foo").getMember("exports") |
| foo | | file://:0:0:0:0 | use moduleImport("foo").getMember("exports").getMember("") |
| foo | | foo.ts:1:8:1:10 | use moduleImport("foo").getMember("exports").getMember("default") |
| foo | Bar | foo.ts:3:12:3:12 | use moduleImport("foo").getMember("exports").getMember("Bar").getInstance() |

View File

@@ -1,9 +0,0 @@
import javascript
from Expr e, TypeName typeName
where e.getType().hasUnderlyingTypeName(typeName)
select e, typeName
query API::Node underlyingTypeNode(string mod, string name) {
result = API::Node::ofType(mod, name)
}

View File

@@ -1,5 +0,0 @@
import foo from "foo";
function f(x: foo.Bar) {
return x;
}

View File

@@ -1,3 +0,0 @@
{
"include": ["."]
}

View File

@@ -1,9 +0,0 @@
interface Base<T> {
x: T;
}
interface Sub<S> extends Base<string> {
y: S;
}
function foo(arg: (Sub<number> & {w: number}) | string) {
}

View File

@@ -1,22 +0,0 @@
getTypeString
| bar/client.ts:9:23:9:27 | Inter | Inter |
| bar/client.ts:10:12:10:14 | Bar | Bar |
| foo/index.ts:2:10:2:12 | Bar | Bar |
| foo/index.ts:7:18:7:22 | Inter | Inter |
| foo/index.ts:8:10:8:12 | Bar | Bar |
importSpec
| false | bar/client.ts:1:10:1:12 | Foo |
| false | bar/client.ts:7:10:7:20 | Foo as Foo2 |
| true | bar/client.ts:7:23:7:32 | type Inter |
| true | bar/client.ts:7:35:7:42 | type Bar |
#select
| bar/client.ts:3:5:3:5 | f | my-awesome-package | Foo |
| bar/client.ts:3:9:3:17 | new Foo() | my-awesome-package | Foo |
| bar/client.ts:4:5:4:5 | b | my-awesome-package | Bar |
| bar/client.ts:4:9:4:9 | f | my-awesome-package | Foo |
| bar/client.ts:4:9:4:15 | f.bar() | my-awesome-package | Bar |
| bar/client.ts:11:16:11:24 | new Foo() | my-awesome-package | Foo |
| bar/client.ts:11:16:11:30 | new Foo().bar() | my-awesome-package | Bar |
| foo/index.ts:1:14:1:16 | Foo | my-awesome-package | Foo |
| foo/index.ts:2:23:2:31 | new Bar() | my-awesome-package | Bar |
| foo/index.ts:5:14:5:16 | Bar | my-awesome-package | Bar |

View File

@@ -1,11 +0,0 @@
import javascript
query string getTypeString(TypeExpr te) { result = te.getType().toString() }
query ImportSpecifier importSpec(boolean typeOnly) {
if result.isTypeOnly() then typeOnly = true else typeOnly = false
}
from Expr e, string mod, string name
where e.getType().(TypeReference).hasQualifiedName(mod, name)
select e, mod, name

View File

@@ -1,13 +0,0 @@
import { Foo } from "../foo";
let f = new Foo();
let b = f.bar();
import { Foo as Foo2, type Inter, type Bar } from "../foo";
class Impl implements Inter {
bar(): Bar {
return new Foo().bar();
}
}

View File

@@ -1,9 +0,0 @@
export class Foo {
bar(): Bar { return new Bar() }
}
export class Bar {}
export interface Inter {
bar(): Bar;
}

View File

@@ -1,3 +0,0 @@
{
"name": "my-awesome-package"
}

View File

@@ -1,3 +0,0 @@
{
"include": ["foo", "bar"]
}

View File

@@ -1,2 +0,0 @@
| Foo | boolean |
| typeof Foo in global scope | string |

View File

@@ -1,3 +0,0 @@
import javascript
query Type stringIndexType(Type t) { result = t.getStringIndexType() }

View File

@@ -1,8 +0,0 @@
// static index signature
class Foo {
static hello = "world";
static [n: string]: string;
[n: string]: boolean;
}
Foo["whatever"] = "foo";
new Foo()["something"] = true;

View File

@@ -1,8 +0,0 @@
interface X {
a: RecursiveMappedType<this> & X;
b: boolean;
}
type RecursiveMappedType<V> = {
[P in keyof V]?: X & RecursiveMappedType<V[P]>
}

View File

@@ -1,2 +0,0 @@
| recursiveMappedType.ts:2:5:2:5 | a | RecursiveMappedType<this> & X |
| recursiveMappedType.ts:3:5:3:5 | b | boolean |

View File

@@ -1,4 +0,0 @@
import javascript
from Expr e
select e, e.getType()

View File

@@ -1,3 +0,0 @@
{
"include": ["."]
}

View File

@@ -1,16 +0,0 @@
| C<Bar> | 1 | bar.ts:10:10:10:24 | class C<Bar> {} |
| C<Foo> | 1 | foo.ts:10:10:10:24 | class C<Foo> {} |
| C<number> | 1 | bar.ts:10:10:10:24 | class C<Bar> {} |
| C<number> | 1 | foo.ts:10:10:10:24 | class C<Foo> {} |
| ExportedClass<Bar> | 1 | bar.ts:4:8:4:34 | class E ... Bar> {} |
| ExportedClass<Foo> | 1 | foo.ts:4:8:4:34 | class E ... Foo> {} |
| ExportedClass<number> | 1 | bar.ts:4:8:4:34 | class E ... Bar> {} |
| ExportedClass<number> | 1 | foo.ts:4:8:4:34 | class E ... Foo> {} |
| InnerC<Foo1> | 1 | foo.ts:13:3:13:23 | class I ... oo1> {} |
| InnerC<Foo2> | 1 | foo.ts:18:3:18:23 | class I ... oo2> {} |
| InnerC<number> | 1 | foo.ts:13:3:13:23 | class I ... oo1> {} |
| InnerC<number> | 1 | foo.ts:18:3:18:23 | class I ... oo2> {} |
| LocalClass<Bar> | 1 | bar.ts:3:1:3:24 | class L ... Bar> {} |
| LocalClass<Foo> | 1 | foo.ts:3:1:3:24 | class L ... Foo> {} |
| LocalClass<number> | 1 | bar.ts:3:1:3:24 | class L ... Bar> {} |
| LocalClass<number> | 1 | foo.ts:3:1:3:24 | class L ... Foo> {} |

View File

@@ -1,4 +0,0 @@
import javascript
from TypeReference ref
select ref, count(ref.getADefinition()), ref.getADefinition()

View File

@@ -1,12 +0,0 @@
import * as dummy from "./dummy";
class LocalClass<Bar> {}
export class ExportedClass<Bar> {}
let localBar = new LocalClass<number>();
let exportedBar = new ExportedClass<number>();
namespace LocalNamespace {
export class C<Bar> {}
let barC = new C<number>();
}

View File

@@ -1 +0,0 @@
export let x = 5;

View File

@@ -1,20 +0,0 @@
import * as dummy from "./dummy";
class LocalClass<Foo> {}
export class ExportedClass<Foo> {}
let localFoo = new LocalClass<number>();
let exportedFoo = new ExportedClass<number>();
namespace LocalNamespace {
export class C<Foo> {}
let fooC = new C<number>();
class InnerC<Foo1> {}
let innerFoo1 = new InnerC<number>();
}
namespace LocalNamespace {
class InnerC<Foo2> {}
let innerFoo2 = new InnerC<number>();
}

View File

@@ -1,4 +0,0 @@
| 32 | 32.0 |
| 40.123 | 40.123 |
| 45 | 45.0 |
| 1099511627776 | 1.099511627776E12 |

View File

@@ -1,4 +0,0 @@
import javascript
from NumberLiteralType type
select type, type.getFloatValue()

View File

@@ -1,2 +0,0 @@
| 32 | 32 |
| 45 | 45 |

View File

@@ -1,4 +0,0 @@
import javascript
from NumberLiteralType type
select type, type.getIntValue()

View File

@@ -1,11 +0,0 @@
| 32 | 32 |
| 40.123 | 40.123 |
| 45 | 45 |
| 1099511627776 | 1099511627776 |
| "31" | 31 |
| "" | |
| "A;B;C" | A;B;C |
| "dsfg" | dsfg |
| "sdfg" | sdfg |
| false | false |
| true | true |

View File

@@ -1,4 +0,0 @@
import javascript
from LiteralType type
select type, type.getStringValue()

View File

@@ -1,3 +0,0 @@
{
"include": ["."]
}

View File

@@ -1,12 +0,0 @@
let intValue = 45;
let floatValue = 40.123;
let hexValue = 0x20; // 32
let intWith40Bits = 1099511627776;
let stringValue = "dsfg";
let stringValueType: "sdfg";
let emptyStringType: "" = "";
let semicolonString = "A;B;C";
let numberStringValue = "31";
let longStringValue = "very long string very long string very long string very long string very long string very long string very long string very long string very long string very long string";
let trueValue = true;
let falseValue = false;

View File

@@ -1,36 +0,0 @@
| tst.ts:2:3:2:6 | name | string |
| tst.ts:3:3:3:10 | children | T[] |
| tst.ts:6:5:6:11 | context | T |
| tst.ts:6:18:17:1 | {\\n nam ... }\\n ]\\n} | T |
| tst.ts:7:3:7:6 | name | string |
| tst.ts:7:9:7:11 | 'x' | "x" |
| tst.ts:8:3:8:10 | children | ({ name: string; } \| { name: string; children: ... |
| tst.ts:8:13:16:3 | [\\n { ... }\\n ] | T[] |
| tst.ts:9:5:9:18 | { name: 'x1' } | T |
| tst.ts:9:7:9:10 | name | string |
| tst.ts:9:13:9:16 | 'x1' | "x1" |
| tst.ts:10:5:15:5 | {\\n ... ]\\n } | T |
| tst.ts:11:7:11:10 | name | string |
| tst.ts:11:13:11:16 | 'x2' | "x2" |
| tst.ts:12:7:12:14 | children | { name: string; }[] |
| tst.ts:12:17:14:7 | [\\n ... ] | T[] |
| tst.ts:13:9:13:22 | { name: 'x3' } | T |
| tst.ts:13:11:13:14 | name | string |
| tst.ts:13:17:13:20 | 'x3' | "x3" |
| tst.ts:19:5:19:13 | nocontext | { name: string; children: ({ name: string; chil... |
| tst.ts:19:17:30:1 | {\\n nam ... }\\n ]\\n} | { name: string; children: ({ name: string; } \| ... |
| tst.ts:20:3:20:6 | name | string |
| tst.ts:20:9:20:11 | 'x' | "x" |
| tst.ts:21:3:21:10 | children | ({ name: string; } \| { name: string; children: ... |
| tst.ts:21:13:29:3 | [\\n { ... }\\n ] | ({ name: string; } \| { name: string; children: ... |
| tst.ts:22:5:22:18 | { name: 'x1' } | { name: string; } |
| tst.ts:22:7:22:10 | name | string |
| tst.ts:22:13:22:16 | 'x1' | "x1" |
| tst.ts:23:5:28:5 | {\\n ... ]\\n } | { name: string; children: { name: string; }[]; } |
| tst.ts:24:7:24:10 | name | string |
| tst.ts:24:13:24:16 | 'x2' | "x2" |
| tst.ts:25:7:25:14 | children | { name: string; }[] |
| tst.ts:25:17:27:7 | [\\n ... ] | { name: string; }[] |
| tst.ts:26:9:26:22 | { name: 'x3' } | { name: string; } |
| tst.ts:26:11:26:14 | name | string |
| tst.ts:26:17:26:20 | 'x3' | "x3" |

View File

@@ -1,4 +0,0 @@
import javascript
from Expr e
select e, e.getType()

View File

@@ -1 +0,0 @@
{ "include": ["."] }

Some files were not shown because too many files have changed in this diff Show More