Allow specialised instances of anonymous classes

This commit is contained in:
Chris Smowton
2022-10-14 18:47:00 +01:00
parent 73f5dea51e
commit 8553266aae
7 changed files with 74 additions and 74 deletions

View File

@@ -1,15 +1,33 @@
enclosingTypes
| file:///!unknown-binary-location/A$<no name provided>.class:0:0:0:0 | new If<T>(...) { ... }<> | file:///!unknown-binary-location/A.class:0:0:0:0 | A<CharSequence> |
| file:///!unknown-binary-location/A$<no name provided>.class:0:0:0:0 | new If<T>(...) { ... }<> | file:///!unknown-binary-location/A.class:0:0:0:0 | A<String> |
| test.kt:9:18:11:3 | new If<T>(...) { ... } | test.kt:7:1:22:1 | A |
| test.kt:13:33:15:3 | new If<T>(...) { ... } | test.kt:7:1:22:1 | A |
| test.kt:13:33:15:3 | new If<T>(...) { ... }<> | test.kt:7:1:22:1 | A<> |
#select
| file:///!unknown-binary-location/A$<no name provided>.class:0:0:0:0 | new If<T>(...) { ... }<> | file:///!unknown-binary-location/A$<no name provided>.class:0:0:0:0 | |
| file:///!unknown-binary-location/A$<no name provided>.class:0:0:0:0 | new If<T>(...) { ... }<> | file:///!unknown-binary-location/A$<no name provided>.class:0:0:0:0 | |
| file:///!unknown-binary-location/A$<no name provided>.class:0:0:0:0 | new If<T>(...) { ... }<> | file:///!unknown-binary-location/A$<no name provided>.class:0:0:0:0 | getX |
| file:///!unknown-binary-location/A$<no name provided>.class:0:0:0:0 | new If<T>(...) { ... }<> | file:///!unknown-binary-location/A$<no name provided>.class:0:0:0:0 | getX |
| file:///!unknown-binary-location/A.class:0:0:0:0 | A<CharSequence> | file:///!unknown-binary-location/A.class:0:0:0:0 | A<CharSequence> |
| file:///!unknown-binary-location/A.class:0:0:0:0 | A<CharSequence> | file:///!unknown-binary-location/A.class:0:0:0:0 | getAnonType |
| file:///!unknown-binary-location/A.class:0:0:0:0 | A<CharSequence> | file:///!unknown-binary-location/A.class:0:0:0:0 | getPrivateAnonType$private |
| file:///!unknown-binary-location/A.class:0:0:0:0 | A<CharSequence> | file:///!unknown-binary-location/A.class:0:0:0:0 | privateUser |
| file:///!unknown-binary-location/A.class:0:0:0:0 | A<String> | file:///!unknown-binary-location/A.class:0:0:0:0 | A<String> |
| file:///!unknown-binary-location/A.class:0:0:0:0 | A<String> | file:///!unknown-binary-location/A.class:0:0:0:0 | getAnonType |
| file:///!unknown-binary-location/A.class:0:0:0:0 | A<String> | file:///!unknown-binary-location/A.class:0:0:0:0 | getPrivateAnonType$private |
| file:///!unknown-binary-location/A.class:0:0:0:0 | A<String> | file:///!unknown-binary-location/A.class:0:0:0:0 | privateUser |
| file:///!unknown-binary-location/If.class:0:0:0:0 | If<String> | file:///!unknown-binary-location/If.class:0:0:0:0 | getX |
| file:///!unknown-binary-location/If.class:0:0:0:0 | If<T> | file:///!unknown-binary-location/If.class:0:0:0:0 | getX |
| other.kt:1:1:1:34 | Ext | other.kt:1:1:1:34 | Ext |
| test.kt:0:0:0:0 | TestKt | test.kt:19:1:19:38 | user |
| test.kt:0:0:0:0 | TestKt | test.kt:24:1:24:38 | user |
| test.kt:1:1:5:1 | If | test.kt:3:3:3:11 | getX |
| test.kt:7:1:17:1 | A | test.kt:7:6:17:1 | A |
| test.kt:7:1:17:1 | A | test.kt:9:3:11:3 | anonType |
| test.kt:7:1:17:1 | A | test.kt:9:3:11:3 | getAnonType |
| test.kt:7:1:17:1 | A | test.kt:13:3:15:3 | privateAnonType |
| test.kt:7:1:17:1 | A | test.kt:13:11:15:3 | getPrivateAnonType$private |
| test.kt:7:1:22:1 | A | test.kt:7:6:22:1 | A |
| test.kt:7:1:22:1 | A | test.kt:9:3:11:3 | anonType |
| test.kt:7:1:22:1 | A | test.kt:9:3:11:3 | getAnonType |
| test.kt:7:1:22:1 | A | test.kt:13:3:15:3 | privateAnonType |
| test.kt:7:1:22:1 | A | test.kt:13:11:15:3 | getPrivateAnonType$private |
| test.kt:7:1:22:1 | A | test.kt:17:3:20:3 | privateUser |
| test.kt:9:18:11:3 | new If<T>(...) { ... } | test.kt:9:18:11:3 | |
| test.kt:9:18:11:3 | new If<T>(...) { ... } | test.kt:10:5:10:22 | x |
| test.kt:9:18:11:3 | new If<T>(...) { ... } | test.kt:10:14:10:22 | getX |

View File

@@ -14,6 +14,11 @@ open class A<T>(t: T) {
override val x = t
}
fun privateUser(x: A<String>, y: A<CharSequence>) {
val a = x.privateAnonType.x
val b = y.privateAnonType.x
}
}
fun user(x: A<String>) = x.anonType.x

View File

@@ -3,3 +3,7 @@ import java
from ClassOrInterface ci, Member m
where m = ci.getAMember() and ci.getSourceDeclaration().fromSource()
select ci, m
query predicate enclosingTypes(NestedType nt, Type encl) {
nt.getSourceDeclaration().fromSource() and encl = nt.getEnclosingType()
}