Fix constructor extraction and extract type arguments of constructor calls

This commit is contained in:
Tamas Vajk
2021-10-07 16:21:02 +02:00
committed by Ian Lynagh
parent 936c29b70c
commit b542769fe9
9 changed files with 103 additions and 58 deletions

View File

@@ -5,7 +5,7 @@ comments
| comments.kt:18:9:18:25 | // A line comment | // A line comment |
| comments.kt:22:5:24:6 | /*\n A block comment\n */ | /*\n A block comment\n */ |
commentOwners
| comments.kt:4:1:11:3 | /**\n * A group of *members*.\n *\n * This class has no useful logic; it's just a documentation example.\n *\n * @property name the name of this group.\n * @constructor Creates an empty group.\n */ | comments.kt:12:1:25:1 | <init> |
| comments.kt:4:1:11:3 | /**\n * A group of *members*.\n *\n * This class has no useful logic; it's just a documentation example.\n *\n * @property name the name of this group.\n * @constructor Creates an empty group.\n */ | comments.kt:12:1:25:1 | Group |
| comments.kt:4:1:11:3 | /**\n * A group of *members*.\n *\n * This class has no useful logic; it's just a documentation example.\n *\n * @property name the name of this group.\n * @constructor Creates an empty group.\n */ | comments.kt:12:1:25:1 | Group |
| comments.kt:4:1:11:3 | /**\n * A group of *members*.\n *\n * This class has no useful logic; it's just a documentation example.\n *\n * @property name the name of this group.\n * @constructor Creates an empty group.\n */ | comments.kt:12:1:25:1 | equals |
| comments.kt:4:1:11:3 | /**\n * A group of *members*.\n *\n * This class has no useful logic; it's just a documentation example.\n *\n * @property name the name of this group.\n * @constructor Creates an empty group.\n */ | comments.kt:12:1:25:1 | hashCode |

View File

@@ -0,0 +1,5 @@
[VALUE_NOT_IN_TYPE] predicate typeArgs(@reftype argumentid, int pos, @typeorcallable parentid): Value 55 of field argumentid is not in type @reftype. The value is however in the following types: @primitive. Appears in tuple (55,0,189)
Relevant element: argumentid=55
Full ID for 55: @"type;boolean"
Relevant element: parentid=189
Full ID for 189: @"class;kotlin.reflect.KClass;(55)". The ID may expand to @"class;kotlin.reflect.KClass;{@"type;boolean"}"

View File

@@ -47,7 +47,7 @@
| exprs.kt:53:9:53:18 | ...=... | AssignExpr |
| exprs.kt:53:9:53:18 | n | VarAccess |
| exprs.kt:53:9:53:18 | n | VarAccess |
| exprs.kt:54:27:54:31 | (no string representation) | ClassInstanceExpr |
| exprs.kt:54:27:54:31 | new C(...) | ClassInstanceExpr |
| exprs.kt:54:29:54:30 | 42 | IntegerLiteral |
| file://:0:0:0:0 | b1 | LocalVariableDeclExpr |
| file://:0:0:0:0 | b2 | LocalVariableDeclExpr |

View File

@@ -1,31 +1,31 @@
[VALUE_NOT_IN_TYPE] predicate typeArgs(@reftype argumentid, int pos, @typeorcallable parentid): Value 11 of field argumentid is not in type @reftype. The value is however in the following types: @primitive. Appears in tuple (11,0,132)
Relevant element: argumentid=11
Full ID for 11: @"type;int"
Relevant element: parentid=132
Full ID for 132: @"class;foo.bar.C1;(11);(11)". The ID may expand to @"class;foo.bar.C1;{@"type;int"};{@"type;int"}"
[VALUE_NOT_IN_TYPE] predicate typeArgs(@reftype argumentid, int pos, @typeorcallable parentid): Value 11 of field argumentid is not in type @reftype. The value is however in the following types: @primitive. Appears in tuple (11,0,197)
Relevant element: argumentid=11
Full ID for 11: @"type;int"
Relevant element: parentid=197
Full ID for 197: @"class;foo.bar.C0;(11)". The ID may expand to @"class;foo.bar.C0;{@"type;int"}"
[VALUE_NOT_IN_TYPE] predicate typeArgs(@reftype argumentid, int pos, @typeorcallable parentid): Value 11 of field argumentid is not in type @reftype. The value is however in the following types: @primitive. Appears in tuple (11,1,132)
Relevant element: argumentid=11
Full ID for 11: @"type;int"
Relevant element: parentid=132
Full ID for 132: @"class;foo.bar.C1;(11);(11)". The ID may expand to @"class;foo.bar.C1;{@"type;int"};{@"type;int"}"
[VALUE_NOT_IN_TYPE] predicate typeArgs(@reftype argumentid, int pos, @typeorcallable parentid): Value 11 of field argumentid is not in type @reftype. The value is however in the following types: @primitive. Appears in tuple (11,1,157)
Relevant element: argumentid=11
Full ID for 11: @"type;int"
Relevant element: parentid=157
Full ID for 157: @"class;foo.bar.C1;(13);(11)". The ID may expand to @"class;foo.bar.C1;{@"type;string"};{@"type;int"}"
[VALUE_NOT_IN_TYPE] predicate typeArgs(@reftype argumentid, int pos, @typeorcallable parentid): Value 13 of field argumentid is not in type @reftype. The value is however in the following types: @primitive. Appears in tuple (13,0,146)
Relevant element: argumentid=13
Full ID for 13: @"type;string"
Relevant element: parentid=146
Full ID for 146: @"class;foo.bar.C1;(13);(13)". The ID may expand to @"class;foo.bar.C1;{@"type;string"};{@"type;string"}"
[VALUE_NOT_IN_TYPE] predicate typeArgs(@reftype argumentid, int pos, @typeorcallable parentid): Value 13 of field argumentid is not in type @reftype. The value is however in the following types: @primitive. Appears in tuple (13,0,157)
Relevant element: argumentid=13
Full ID for 13: @"type;string"
Relevant element: parentid=157
Full ID for 157: @"class;foo.bar.C1;(13);(11)". The ID may expand to @"class;foo.bar.C1;{@"type;string"};{@"type;int"}"
[VALUE_NOT_IN_TYPE] predicate typeArgs(@reftype argumentid, int pos, @typeorcallable parentid): Value 12 of field argumentid is not in type @reftype. The value is however in the following types: @primitive. Appears in tuple (12,0,135)
Relevant element: argumentid=12
Full ID for 12: @"type;int"
Relevant element: parentid=135
Full ID for 135: @"class;foo.bar.C1;(12);(12)". The ID may expand to @"class;foo.bar.C1;{@"type;int"};{@"type;int"}"
[VALUE_NOT_IN_TYPE] predicate typeArgs(@reftype argumentid, int pos, @typeorcallable parentid): Value 12 of field argumentid is not in type @reftype. The value is however in the following types: @primitive. Appears in tuple (12,0,206)
Relevant element: argumentid=12
Full ID for 12: @"type;int"
Relevant element: parentid=206
Full ID for 206: @"class;foo.bar.C0;(12)". The ID may expand to @"class;foo.bar.C0;{@"type;int"}"
[VALUE_NOT_IN_TYPE] predicate typeArgs(@reftype argumentid, int pos, @typeorcallable parentid): Value 12 of field argumentid is not in type @reftype. The value is however in the following types: @primitive. Appears in tuple (12,1,135)
Relevant element: argumentid=12
Full ID for 12: @"type;int"
Relevant element: parentid=135
Full ID for 135: @"class;foo.bar.C1;(12);(12)". The ID may expand to @"class;foo.bar.C1;{@"type;int"};{@"type;int"}"
[VALUE_NOT_IN_TYPE] predicate typeArgs(@reftype argumentid, int pos, @typeorcallable parentid): Value 12 of field argumentid is not in type @reftype. The value is however in the following types: @primitive. Appears in tuple (12,1,163)
Relevant element: argumentid=12
Full ID for 12: @"type;int"
Relevant element: parentid=163
Full ID for 163: @"class;foo.bar.C1;(14);(12)". The ID may expand to @"class;foo.bar.C1;{@"type;string"};{@"type;int"}"
[VALUE_NOT_IN_TYPE] predicate typeArgs(@reftype argumentid, int pos, @typeorcallable parentid): Value 14 of field argumentid is not in type @reftype. The value is however in the following types: @primitive. Appears in tuple (14,0,152)
Relevant element: argumentid=14
Full ID for 14: @"type;string"
Relevant element: parentid=152
Full ID for 152: @"class;foo.bar.C1;(14);(14)". The ID may expand to @"class;foo.bar.C1;{@"type;string"};{@"type;string"}"
[VALUE_NOT_IN_TYPE] predicate typeArgs(@reftype argumentid, int pos, @typeorcallable parentid): Value 14 of field argumentid is not in type @reftype. The value is however in the following types: @primitive. Appears in tuple (14,0,163)
Relevant element: argumentid=14
Full ID for 14: @"type;string"
Relevant element: parentid=163
Full ID for 163: @"class;foo.bar.C1;(14);(12)". The ID may expand to @"class;foo.bar.C1;{@"type;string"};{@"type;int"}"
[VALUE_NOT_IN_TYPE] predicate typeArgs(@reftype argumentid, int pos, @typeorcallable parentid): More errors, not displayed. There are 7 values of field argumentid that are not in type @reftype for a relation of size 12

View File

@@ -27,3 +27,11 @@ genericCall
| generics.kt:27:17:27:22 | f2(...) | generics.kt:15:10:15:10 | U | file://:0:0:0:0 | string |
| generics.kt:30:17:30:21 | f2(...) | generics.kt:15:10:15:10 | U | file://:0:0:0:0 | int |
| generics.kt:32:8:32:12 | f4(...) | generics.kt:21:10:21:10 | P | file://:0:0:0:0 | int |
genericCtor
| generics.kt:16:16:16:26 | new C1(...) | 0 | generics.kt:15:10:15:10 | U |
| generics.kt:16:16:16:26 | new C1(...) | 1 | generics.kt:15:10:15:10 | U |
| generics.kt:25:14:25:28 | new C1(...) | 0 | file://:0:0:0:0 | int |
| generics.kt:25:14:25:28 | new C1(...) | 1 | file://:0:0:0:0 | int |
| generics.kt:28:14:28:32 | new C1(...) | 0 | file://:0:0:0:0 | string |
| generics.kt:28:14:28:32 | new C1(...) | 1 | file://:0:0:0:0 | int |
| generics.kt:33:21:33:29 | new C0(...) | 0 | file://:0:0:0:0 | int |

View File

@@ -12,3 +12,7 @@ query predicate genericFunction(GenericCallable c, TypeVariable tv, int i) {
}
query predicate genericCall(GenericCall c, TypeVariable tv, Type t) { c.getATypeArgument(tv) = t }
query predicate genericCtor(ClassInstanceExpr c, int i, Type ta) {
c.getTypeArgument(i).getType() = ta
}

View File

@@ -1,5 +1,4 @@
methods
| file://:0:0:0:0 | <init> |
| file://:0:0:0:0 | equals |
| file://:0:0:0:0 | equals |
| file://:0:0:0:0 | hashCode |
@@ -7,27 +6,29 @@ methods
| file://:0:0:0:0 | toString |
| file://:0:0:0:0 | toString |
| methods2.kt:4:1:5:1 | fooBarTopLevelMethod |
| methods2.kt:7:1:10:1 | <init> |
| methods2.kt:7:1:10:1 | <obinit> |
| methods2.kt:7:1:10:1 | equals |
| methods2.kt:7:1:10:1 | hashCode |
| methods2.kt:7:1:10:1 | toString |
| methods2.kt:8:5:9:5 | fooBarClassMethod |
| methods3.kt:3:1:3:39 | fooBarTopLevelMethod |
| methods3.kt:5:1:7:1 | <init> |
| methods3.kt:5:1:7:1 | <obinit> |
| methods3.kt:5:1:7:1 | equals |
| methods3.kt:5:1:7:1 | hashCode |
| methods3.kt:5:1:7:1 | toString |
| methods3.kt:6:5:6:43 | fooBarTopLevelMethod |
| methods.kt:2:1:3:1 | topLevelMethod |
| methods.kt:5:1:13:1 | <init> |
| methods.kt:5:1:13:1 | <obinit> |
| methods.kt:5:1:13:1 | equals |
| methods.kt:5:1:13:1 | hashCode |
| methods.kt:5:1:13:1 | toString |
| methods.kt:6:5:7:5 | classMethod |
| methods.kt:9:5:12:5 | anotherClassMethod |
constructors
| file://:0:0:0:0 | Any |
| methods2.kt:7:1:10:1 | Class2 |
| methods3.kt:5:1:7:1 | Class3 |
| methods.kt:5:1:13:1 | Class |
extensions
| methods3.kt:3:1:3:39 | fooBarTopLevelMethod | file://:0:0:0:0 | int |
| methods3.kt:6:5:6:43 | fooBarTopLevelMethod | file://:0:0:0:0 | int |

View File

@@ -2,4 +2,6 @@ import java
query predicate methods(Method m) { any() }
query predicate constructors(Constructor c) { any() }
query predicate extensions(ExtensionMethod m, Type t) { m.getExtendedType() = t }