FIR: forbid java.lang.String(String) constructor in JvmMappedScope

#KT-49135 Fixed
This commit is contained in:
Mikhail Glukhikh
2021-10-14 17:44:47 +03:00
committed by TeamCityServer
parent 09bc729b0e
commit f4067f05a2
6 changed files with 30 additions and 0 deletions
@@ -5111,6 +5111,12 @@ public class DiagnosisCompilerFirTestdataTestGenerated extends AbstractDiagnosis
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/intellij/PersistentStateComponent.kt");
}
@Test
@TestMetadata("typeAliasAmbiguity.kt")
public void testTypeAliasAmbiguity() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/intellij/typeAliasAmbiguity.kt");
}
@Test
@TestMetadata("UastPatterns.kt")
public void testUastPatterns() throws Exception {
@@ -0,0 +1,7 @@
FILE: typeAliasAmbiguity.kt
public final typealias ServiceId = R|kotlin/String|
public final fun ServiceId(serviceId: R|kotlin/String|): R|ServiceId| {
^ServiceId R|<local>/serviceId|
}
public final val GaugeSpecTmsIntegrationServiceId: R|ServiceId| = R|/ServiceId|(String(Gauge))
public get(): R|ServiceId|
@@ -0,0 +1,4 @@
typealias ServiceId = String
fun ServiceId(serviceId: String): ServiceId = serviceId
// FE 1.0 resolves this to function
val GaugeSpecTmsIntegrationServiceId = ServiceId("Gauge")
@@ -5111,6 +5111,12 @@ public class FirDiagnosticTestGenerated extends AbstractFirDiagnosticTest {
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/intellij/PersistentStateComponent.kt");
}
@Test
@TestMetadata("typeAliasAmbiguity.kt")
public void testTypeAliasAmbiguity() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/intellij/typeAliasAmbiguity.kt");
}
@Test
@TestMetadata("UastPatterns.kt")
public void testUastPatterns() throws Exception {
@@ -5111,6 +5111,12 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/intellij/PersistentStateComponent.kt");
}
@Test
@TestMetadata("typeAliasAmbiguity.kt")
public void testTypeAliasAmbiguity() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/intellij/typeAliasAmbiguity.kt");
}
@Test
@TestMetadata("UastPatterns.kt")
public void testUastPatterns() throws Exception {
@@ -146,6 +146,7 @@ class JvmMappedScope(
"Lkotlin/IntArray;II",
"Ljava/lang/StringBuffer;",
"Ljava/lang/StringBuilder;",
"Ljava/lang/String;",
).mapTo(this) { arguments -> "java/lang/String.<init>($arguments)V" }
listOf(