K2: add a reproducer for getOrDefault false negative in metadata compilation

This case is similar to KT-57268 in early JDKs
This commit is contained in:
Mikhail Glukhikh
2024-01-30 10:40:57 +01:00
committed by Space Team
parent 38aec7333b
commit 7599ff0ef1
4 changed files with 11 additions and 0 deletions
+3
View File
@@ -0,0 +1,3 @@
$TESTDATA_DIR$/getOrDefault.kt
-d
$TEMP_DIR$
+2
View File
@@ -0,0 +1,2 @@
// This should not compile: only JVM 1.8+ contains getOrDefault
fun foo(map: Map<String, Int>) = map.getOrDefault("", 0)
+1
View File
@@ -0,0 +1 @@
OK
@@ -1549,6 +1549,11 @@ public class CliTestGenerated extends AbstractCliTest {
runTest("compiler/testData/cli/metadata/anonymousObjectType.args");
}
@TestMetadata("getOrDefault.args")
public void testGetOrDefault() throws Exception {
runTest("compiler/testData/cli/metadata/getOrDefault.args");
}
@TestMetadata("hmppModules.args")
public void testHmppModules() throws Exception {
runTest("compiler/testData/cli/metadata/hmppModules.args");