[K1, K2] Use safe names when accessing to type parameters

^KT-57529 Fixed
This commit is contained in:
Ivan Kochurkin
2023-11-07 17:06:55 +01:00
parent 3188f01720
commit 64db96eda3
8 changed files with 42 additions and 3 deletions
@@ -12306,6 +12306,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
runTest("compiler/testData/diagnostics/tests/exceptions/incorrectCallOnILT.kt");
}
@Test
@TestMetadata("keywordsInsteadOfIdentifiers.kt")
public void testKeywordsInsteadOfIdentifiers() throws Exception {
runTest("compiler/testData/diagnostics/tests/exceptions/keywordsInsteadOfIdentifiers.kt");
}
@Test
@TestMetadata("kt24158.kt")
public void testKt24158() throws Exception {
@@ -12306,6 +12306,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
runTest("compiler/testData/diagnostics/tests/exceptions/incorrectCallOnILT.kt");
}
@Test
@TestMetadata("keywordsInsteadOfIdentifiers.kt")
public void testKeywordsInsteadOfIdentifiers() throws Exception {
runTest("compiler/testData/diagnostics/tests/exceptions/keywordsInsteadOfIdentifiers.kt");
}
@Test
@TestMetadata("kt24158.kt")
public void testKt24158() throws Exception {
@@ -12300,6 +12300,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
runTest("compiler/testData/diagnostics/tests/exceptions/incorrectCallOnILT.kt");
}
@Test
@TestMetadata("keywordsInsteadOfIdentifiers.kt")
public void testKeywordsInsteadOfIdentifiers() throws Exception {
runTest("compiler/testData/diagnostics/tests/exceptions/keywordsInsteadOfIdentifiers.kt");
}
@Test
@TestMetadata("kt24158.kt")
public void testKt24158() throws Exception {
@@ -12306,6 +12306,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
runTest("compiler/testData/diagnostics/tests/exceptions/incorrectCallOnILT.kt");
}
@Test
@TestMetadata("keywordsInsteadOfIdentifiers.kt")
public void testKeywordsInsteadOfIdentifiers() throws Exception {
runTest("compiler/testData/diagnostics/tests/exceptions/keywordsInsteadOfIdentifiers.kt");
}
@Test
@TestMetadata("kt24158.kt")
public void testKt24158() throws Exception {
@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.fir.resolve.inference
import org.jetbrains.kotlin.fir.declarations.FirAnonymousFunction
import org.jetbrains.kotlin.fir.symbols.impl.FirTypeParameterSymbol
import org.jetbrains.kotlin.fir.types.ConeTypeVariable
import org.jetbrains.kotlin.name.SpecialNames
class ConeTypeVariableForPostponedAtom(name: String) : ConeTypeVariable(name)
class ConeTypeVariableForLambdaParameterType(name: String, val index: Int) : ConeTypeVariable(name)
@@ -15,4 +16,4 @@ class ConeTypeVariableForLambdaReturnType(val argument: FirAnonymousFunction, na
class ConeTypeParameterBasedTypeVariable(
val typeParameterSymbol: FirTypeParameterSymbol
) : ConeTypeVariable(typeParameterSymbol.name.identifier, typeParameterSymbol.toLookupTag())
) : ConeTypeVariable(SpecialNames.safeIdentifier(typeParameterSymbol.name).identifier, typeParameterSymbol.toLookupTag())
@@ -19,7 +19,7 @@ package org.jetbrains.kotlin.resolve.calls.inference.model
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
import org.jetbrains.kotlin.descriptors.ClassifierDescriptor
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor
import org.jetbrains.kotlin.descriptors.annotations.Annotations
import org.jetbrains.kotlin.name.SpecialNames
import org.jetbrains.kotlin.resolve.calls.model.PostponableKotlinCallArgument
import org.jetbrains.kotlin.resolve.descriptorUtil.builtIns
import org.jetbrains.kotlin.resolve.descriptorUtil.hasOnlyInputTypesAnnotation
@@ -76,7 +76,7 @@ fun TypeConstructor.typeForTypeVariable(): SimpleType {
class TypeVariableFromCallableDescriptor(
val originalTypeParameter: TypeParameterDescriptor
) : NewTypeVariable(originalTypeParameter.builtIns, originalTypeParameter.name.identifier, originalTypeParameter) {
) : NewTypeVariable(originalTypeParameter.builtIns, SpecialNames.safeIdentifier(originalTypeParameter.name).identifier, originalTypeParameter) {
override fun hasOnlyInputTypesAnnotation(): Boolean = originalTypeParameter.hasOnlyInputTypesAnnotation()
}
@@ -0,0 +1,8 @@
// FIR_IDENTICAL
// ISSUE: KT-57529
fun <<!SYNTAX!>break<!>> foo() {}
fun test(){
foo<String>()
}
@@ -12306,6 +12306,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
runTest("compiler/testData/diagnostics/tests/exceptions/incorrectCallOnILT.kt");
}
@Test
@TestMetadata("keywordsInsteadOfIdentifiers.kt")
public void testKeywordsInsteadOfIdentifiers() throws Exception {
runTest("compiler/testData/diagnostics/tests/exceptions/keywordsInsteadOfIdentifiers.kt");
}
@Test
@TestMetadata("kt24158.kt")
public void testKt24158() throws Exception {