Add extra tests for FIR J/K type mapping
This commit is contained in:
@@ -1,6 +1,28 @@
|
||||
// FULL_JDK
|
||||
// FILE: YourException.java
|
||||
class YourException extends Exception {
|
||||
|
||||
}
|
||||
|
||||
// FILE: test.kt
|
||||
import java.io.PrintStream
|
||||
|
||||
class MyException : Exception()
|
||||
|
||||
fun test(e: MyException) {
|
||||
fun test(e: MyException, stream: PrintStream) {
|
||||
e.printStackTrace() // Cannot be resolved with early J2K mapping due deriving of kotlin.Throwable instead of java.lang.Throwable
|
||||
e.printStackTrace(stream)
|
||||
val result = e.getLocalizedMessage()
|
||||
}
|
||||
|
||||
fun test(e: YourException, stream: PrintStream) {
|
||||
e.printStackTrace()
|
||||
e.printStackTrace(stream)
|
||||
val result = e.getLocalizedMessage()
|
||||
}
|
||||
|
||||
fun test(e: Exception, stream: PrintStream) {
|
||||
e.printStackTrace()
|
||||
e.printStackTrace(stream)
|
||||
val result = e.getLocalizedMessage()
|
||||
}
|
||||
@@ -1,10 +1,22 @@
|
||||
FILE: MyException.kt
|
||||
FILE: test.kt
|
||||
public final class MyException : R|kotlin/Exception| {
|
||||
public constructor(): R|MyException| {
|
||||
super<R|kotlin/Exception|>()
|
||||
}
|
||||
|
||||
}
|
||||
public final fun test(e: R|MyException|): R|kotlin/Unit| {
|
||||
public final fun test(e: R|MyException|, stream: R|java/io/PrintStream|): R|kotlin/Unit| {
|
||||
R|<local>/e|.R|kotlin/printStackTrace|()
|
||||
R|<local>/e|.R|kotlin/printStackTrace|(R|<local>/stream|)
|
||||
lval result: <ERROR TYPE REF: Unresolved name: getLocalizedMessage> = R|<local>/e|.<Unresolved name: getLocalizedMessage>#()
|
||||
}
|
||||
public final fun test(e: R|YourException|, stream: R|java/io/PrintStream|): R|kotlin/Unit| {
|
||||
R|<local>/e|.R|kotlin/printStackTrace|()
|
||||
R|<local>/e|.R|kotlin/printStackTrace|(R|<local>/stream|)
|
||||
lval result: <ERROR TYPE REF: Unresolved name: getLocalizedMessage> = R|<local>/e|.<Unresolved name: getLocalizedMessage>#()
|
||||
}
|
||||
public final fun test(e: R|kotlin/Exception|, stream: R|java/io/PrintStream|): R|kotlin/Unit| {
|
||||
R|<local>/e|.R|kotlin/printStackTrace|()
|
||||
R|<local>/e|.R|kotlin/printStackTrace|(R|<local>/stream|)
|
||||
lval result: <ERROR TYPE REF: Unresolved name: getLocalizedMessage> = R|<local>/e|.<Unresolved name: getLocalizedMessage>#()
|
||||
}
|
||||
|
||||
@@ -9,3 +9,8 @@ interface UseIterable : MyIterable<String> {
|
||||
val split = spliterator()
|
||||
}
|
||||
}
|
||||
|
||||
fun test(some: Iterable<String>) {
|
||||
val it = some.iterator()
|
||||
val split = some.spliterator()
|
||||
}
|
||||
|
||||
@@ -6,3 +6,7 @@ FILE: test.kt
|
||||
}
|
||||
|
||||
}
|
||||
public final fun test(some: R|kotlin/collections/Iterable<kotlin/String>|): R|kotlin/Unit| {
|
||||
lval it: R|kotlin/collections/Iterator<kotlin/String>| = R|<local>/some|.R|FakeOverride<kotlin/collections/Iterable.iterator: R|kotlin/collections/Iterator<kotlin/String>|>|()
|
||||
lval split: <ERROR TYPE REF: Unresolved name: spliterator> = R|<local>/some|.<Unresolved name: spliterator>#()
|
||||
}
|
||||
|
||||
@@ -6,4 +6,30 @@ public abstract class MyMap implements java.util.Map<String, String> {}
|
||||
// FILE: test.kt
|
||||
fun test(map: MyMap) {
|
||||
val result = map.getOrPut("key") { "value" } // Cannot be resolved without early J2K mapping
|
||||
// In contrast, should be taken from JDK
|
||||
val otherResult = map.getOrDefault("key", "value")
|
||||
val anotherResult = map.replace("key", "value")
|
||||
// Java forEach
|
||||
map.forEach { key, value ->
|
||||
println("$key: $value")
|
||||
}
|
||||
// Kotlin forEach
|
||||
map.forEach { (key, value) ->
|
||||
println("$key: $value")
|
||||
}
|
||||
}
|
||||
|
||||
fun test(map: MutableMap<String, String>) {
|
||||
val result = map.getOrPut("key") { "value" } // Cannot be resolved without early J2K mapping
|
||||
// In contrast, should be taken from JDK
|
||||
val otherResult = map.getOrDefault("key", "value")
|
||||
val anotherResult = map.replace("key", "value")
|
||||
// Java forEach
|
||||
map.forEach { key, value ->
|
||||
println("$key: $value")
|
||||
}
|
||||
// Kotlin forEach
|
||||
map.forEach { (key, value) ->
|
||||
println("$key: $value")
|
||||
}
|
||||
}
|
||||
@@ -4,4 +4,34 @@ FILE: test.kt
|
||||
String(value)
|
||||
}
|
||||
)
|
||||
lval otherResult: R|kotlin/String| = R|<local>/map|.R|FakeOverride<kotlin/collections/Map.getOrDefault: R|kotlin/String|>|(String(key), String(value))
|
||||
lval anotherResult: <ERROR TYPE REF: Unresolved name: replace> = R|<local>/map|.<Unresolved name: replace>#(String(key), String(value))
|
||||
R|<local>/map|.R|kotlin/collections/forEach|<R|kotlin/String|, R|kotlin/String|>(<L> = forEach@fun <anonymous>(key: R|kotlin/collections/Map.Entry<kotlin/String, kotlin/String>|, value: R|kotlin/Any?|): R|kotlin/Unit| <kind=EXACTLY_ONCE> {
|
||||
R|kotlin/io/println|(<strcat>(R|<local>/key|, String(: ), R|<local>/value|))
|
||||
}
|
||||
)
|
||||
R|<local>/map|.R|kotlin/collections/forEach|<R|kotlin/String|, R|kotlin/String|>(<L> = forEach@fun <anonymous>(<destruct>: R|kotlin/collections/Map.Entry<kotlin/String, kotlin/String>|): R|kotlin/Unit| <kind=EXACTLY_ONCE> {
|
||||
lval key: R|kotlin/String| = R|<local>/<destruct>|.R|kotlin/collections/component1|<R|kotlin/String|, R|kotlin/String|>()
|
||||
lval value: R|kotlin/String| = R|<local>/<destruct>|.R|kotlin/collections/component2|<R|kotlin/String|, R|kotlin/String|>()
|
||||
R|kotlin/io/println|(<strcat>(R|<local>/key|, String(: ), R|<local>/value|))
|
||||
}
|
||||
)
|
||||
}
|
||||
public final fun test(map: R|kotlin/collections/MutableMap<kotlin/String, kotlin/String>|): R|kotlin/Unit| {
|
||||
lval result: R|kotlin/String| = R|<local>/map|.R|kotlin/collections/getOrPut|<R|kotlin/String|, R|kotlin/String|>(String(key), <L> = getOrPut@fun <anonymous>(): R|kotlin/String| <kind=EXACTLY_ONCE> {
|
||||
String(value)
|
||||
}
|
||||
)
|
||||
lval otherResult: R|kotlin/String| = R|<local>/map|.R|FakeOverride<kotlin/collections/Map.getOrDefault: R|kotlin/String|>|(String(key), String(value))
|
||||
lval anotherResult: <ERROR TYPE REF: Unresolved name: replace> = R|<local>/map|.<Unresolved name: replace>#(String(key), String(value))
|
||||
R|<local>/map|.R|kotlin/collections/forEach|<R|kotlin/String|, R|kotlin/String|>(<L> = forEach@fun <anonymous>(key: R|kotlin/collections/Map.Entry<kotlin/String, kotlin/String>|, value: R|kotlin/Any?|): R|kotlin/Unit| <kind=EXACTLY_ONCE> {
|
||||
R|kotlin/io/println|(<strcat>(R|<local>/key|, String(: ), R|<local>/value|))
|
||||
}
|
||||
)
|
||||
R|<local>/map|.R|kotlin/collections/forEach|<R|kotlin/String|, R|kotlin/String|>(<L> = forEach@fun <anonymous>(<destruct>: R|kotlin/collections/Map.Entry<kotlin/String, kotlin/String>|): R|kotlin/Unit| <kind=EXACTLY_ONCE> {
|
||||
lval key: R|kotlin/String| = R|<local>/<destruct>|.R|kotlin/collections/component1|<R|kotlin/String|, R|kotlin/String|>()
|
||||
lval value: R|kotlin/String| = R|<local>/<destruct>|.R|kotlin/collections/component2|<R|kotlin/String|, R|kotlin/String|>()
|
||||
R|kotlin/io/println|(<strcat>(R|<local>/key|, String(: ), R|<local>/value|))
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user