Merge pull request #11018 from smowton/smowton/fix/kotlin-extension-specialisation

Kotlin: specialise extension receivers the same as other function parameters
This commit is contained in:
Chris Smowton
2022-10-28 16:15:41 +01:00
committed by GitHub
6 changed files with 34 additions and 11 deletions

View File

@@ -0,0 +1,9 @@
public class User {
public static void test(KotlinClass<String> kc) {
kc.getKotlinVal("Hello world");
}
}

View File

@@ -0,0 +1,4 @@
| User.java:5:5:5:34 | getKotlinVal(...) | getKotlinVal | String |
| test.kt:8:43:8:78 | with(...) | with | Function1<? super T,? extends R> |
| test.kt:8:43:8:78 | with(...) | with | T |
| test.kt:8:68:8:76 | getKotlinVal(...) | getKotlinVal | String |

View File

@@ -0,0 +1,8 @@
class KotlinClass<T> {
val T.kotlinVal: Int
get() = 1
}
fun kotlinUser(kc: KotlinClass<String>) = with(kc) { "hello world".kotlinVal }

View File

@@ -0,0 +1,4 @@
from create_database_utils import *
os.mkdir('build')
run_codeql_database_create(["kotlinc test.kt -d build", "javac User.java -cp build"], lang="java")

View File

@@ -0,0 +1,4 @@
import java
from MethodAccess ma
select ma, ma.getCallee().toString(), ma.getCallee().getAParamType().toString()