[FIR TEST] Add test with MutableMap.compute
This commit is contained in:
@@ -0,0 +1,11 @@
|
|||||||
|
// FULL_JDK
|
||||||
|
// STDLIB_JDK8
|
||||||
|
// !JVM_TARGET: 1.8
|
||||||
|
|
||||||
|
fun <D> MutableMap<String, MutableSet<D>>.initAndAdd(key: String, value: D) {
|
||||||
|
this.<!UNRESOLVED_REFERENCE!>compute<!>(key) { _, maybeValues ->
|
||||||
|
val setOfValues = maybeValues ?: mutableSetOf()
|
||||||
|
setOfValues.<!UNRESOLVED_REFERENCE!>add<!>(value)
|
||||||
|
setOfValues
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
FILE: MapCompute.kt
|
||||||
|
public final fun <D> R|kotlin/collections/MutableMap<kotlin/String, kotlin/collections/MutableSet<D>>|.initAndAdd(key: R|kotlin/String|, value: R|D|): R|kotlin/Unit| {
|
||||||
|
this@R|/initAndAdd|.<Unresolved name: compute>#(R|<local>/key|, <L> = compute@fun <anonymous>(_: R|ERROR CLASS: No type for parameter|, maybeValues: R|ERROR CLASS: No type for parameter|): R|ERROR CLASS: Unresolved: <error>| {
|
||||||
|
lval setOfValues: R|ERROR CLASS: Unresolved: <error>| = when (lval <elvis>: R|ERROR CLASS: No type for parameter| = R|<local>/maybeValues|) {
|
||||||
|
==($subj$, Null(null)) -> {
|
||||||
|
R|kotlin/collections/mutableSetOf|<R|kotlin/Any?|>()
|
||||||
|
}
|
||||||
|
else -> {
|
||||||
|
R|<local>/<elvis>|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
R|<local>/setOfValues|.<Unresolved name: add>#(R|<local>/value|)
|
||||||
|
^ R|<local>/setOfValues|
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
Generated
+5
@@ -544,6 +544,11 @@ public class FirDiagnosticsWithStdlibTestGenerated extends AbstractFirDiagnostic
|
|||||||
runTest("compiler/fir/resolve/testData/resolve/stdlib/j+k/LoggerInstance.kt");
|
runTest("compiler/fir/resolve/testData/resolve/stdlib/j+k/LoggerInstance.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("MapCompute.kt")
|
||||||
|
public void testMapCompute() throws Exception {
|
||||||
|
runTest("compiler/fir/resolve/testData/resolve/stdlib/j+k/MapCompute.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("MapEntry.kt")
|
@TestMetadata("MapEntry.kt")
|
||||||
public void testMapEntry() throws Exception {
|
public void testMapEntry() throws Exception {
|
||||||
runTest("compiler/fir/resolve/testData/resolve/stdlib/j+k/MapEntry.kt");
|
runTest("compiler/fir/resolve/testData/resolve/stdlib/j+k/MapEntry.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user