FIR: Support proper loading of Map.merge

This commit is contained in:
Denis Zharkov
2020-03-06 18:09:40 +03:00
parent 4a1302e385
commit 15a0157c42
4 changed files with 21 additions and 0 deletions
@@ -116,6 +116,10 @@ private fun StringBuilder.appendConeType(coneType: ConeKotlinType) {
appendClassLikeType(representative.coneTypeUnsafe())
}
}
is ConeDefinitelyNotNullType -> {
appendConeType(coneType.original)
return
}
is ConeFlexibleType -> {
appendConeType(coneType.lowerBound)
return
@@ -0,0 +1,5 @@
// FULL_JDK
fun foo(x: MutableMap<String, List<String>>) {
x.merge("", listOf("")) { a, b -> a + b }
}
@@ -0,0 +1,7 @@
FILE: mapMerge.kt
public final fun foo(x: R|kotlin/collections/MutableMap<kotlin/String, kotlin/collections/List<kotlin/String>>|): R|kotlin/Unit| {
R|<local>/x|.R|FakeOverride<java/util/Map.merge: R|kotlin/collections/List<kotlin/String>?|>|(String(), R|kotlin/collections/listOf|<R|kotlin/String|>(String()), <L> = merge@fun <anonymous>(a: R|ft<kotlin/collections/List<kotlin/String>, kotlin/collections/List<kotlin/String>?>!|, b: R|ft<kotlin/collections/List<kotlin/String>, kotlin/collections/List<kotlin/String>?>!|): R|ft<kotlin/collections/List<kotlin/String>, kotlin/collections/List<kotlin/String>?>!| {
^ R|<local>/a|.R|kotlin/collections/plus|<R|kotlin/String|>(R|<local>/b|)
}
)
}
@@ -645,6 +645,11 @@ public class FirDiagnosticsWithStdlibTestGenerated extends AbstractFirDiagnostic
runTest("compiler/fir/resolve/testData/resolveWithStdlib/j+k/MapEntry.kt");
}
@TestMetadata("mapMerge.kt")
public void testMapMerge() throws Exception {
runTest("compiler/fir/resolve/testData/resolveWithStdlib/j+k/mapMerge.kt");
}
@TestMetadata("MyException.kt")
public void testMyException() throws Exception {
runTest("compiler/fir/resolve/testData/resolveWithStdlib/j+k/MyException.kt");