FIR2IR: fix raw SAM conversion (avoid * in type arguments)
This commit is contained in:
+4
-1
@@ -626,7 +626,10 @@ class CallAndReferenceGenerator(
|
||||
if (!needSamConversion(argument, parameter)) {
|
||||
return this
|
||||
}
|
||||
val samFirType = parameter.returnTypeRef.coneTypeSafe<ConeKotlinType>()?.let { substitutor.substituteOrSelf(it) }
|
||||
val samFirType = parameter.returnTypeRef.coneTypeSafe<ConeKotlinType>()?.let {
|
||||
val substituted = substitutor.substituteOrSelf(it)
|
||||
if (substituted is ConeRawType) substituted.lowerBound else substituted
|
||||
}
|
||||
var samType = samFirType?.toIrType(ConversionTypeContext.WITH_INVARIANT) ?: createErrorType()
|
||||
if (shouldUnwrapVarargType) {
|
||||
samType = samType.getArrayElementType(irBuiltIns)
|
||||
|
||||
+6
@@ -14882,6 +14882,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/fir/IrBuiltIns.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("KotlinDocumentationProvider.kt")
|
||||
public void testKotlinDocumentationProvider() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fir/KotlinDocumentationProvider.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("LookupTags.kt")
|
||||
public void testLookupTags() throws Exception {
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// FULL_JDK
|
||||
|
||||
// MODULE: lib
|
||||
// FILE: PsiElement.java
|
||||
|
||||
public interface PsiElement {
|
||||
|
||||
}
|
||||
|
||||
// FILE: PsiElementProcessor.java
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public interface PsiElementProcessor<T extends PsiElement> {
|
||||
boolean execute (@NotNull T element);
|
||||
}
|
||||
|
||||
// FILE: PsiTreeUtil.java
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class PsiTreeUtil {
|
||||
public static boolean processElements(@Nullable PsiElement element, @NotNull PsiElementProcessor processor) {
|
||||
return element != null;
|
||||
}
|
||||
}
|
||||
|
||||
// MODULE: main(lib)
|
||||
// FILE: KotlinDocumentationProvider.kt
|
||||
|
||||
import java.util.function.Consumer
|
||||
|
||||
interface PsiFile : PsiElement {
|
||||
val name: String
|
||||
}
|
||||
|
||||
class KtFile(override val name: String) : PsiFile {
|
||||
val docComment: PsiDocCommentBase get() = PsiDocCommentBase()
|
||||
}
|
||||
|
||||
class PsiDocCommentBase : PsiElement
|
||||
|
||||
fun collectDocComments(file: PsiFile, sink: Consumer<PsiDocCommentBase>): String {
|
||||
if (file !is KtFile) return "FAIL"
|
||||
|
||||
PsiTreeUtil.processElements(file) {
|
||||
val comment = (it as? KtFile)?.docComment
|
||||
if (comment != null) sink.accept(comment)
|
||||
true
|
||||
}
|
||||
|
||||
return file.name
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return collectDocComments(KtFile("OK")) {
|
||||
|
||||
}
|
||||
}
|
||||
+6
@@ -14882,6 +14882,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/fir/IrBuiltIns.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("KotlinDocumentationProvider.kt")
|
||||
public void testKotlinDocumentationProvider() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fir/KotlinDocumentationProvider.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("LookupTags.kt")
|
||||
public void testLookupTags() throws Exception {
|
||||
|
||||
+6
@@ -14882,6 +14882,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/fir/IrBuiltIns.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("KotlinDocumentationProvider.kt")
|
||||
public void testKotlinDocumentationProvider() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fir/KotlinDocumentationProvider.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("LookupTags.kt")
|
||||
public void testLookupTags() throws Exception {
|
||||
|
||||
+5
@@ -12308,6 +12308,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/fir/IrBuiltIns.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("KotlinDocumentationProvider.kt")
|
||||
public void testKotlinDocumentationProvider() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fir/KotlinDocumentationProvider.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("LookupTags.kt")
|
||||
public void testLookupTags() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fir/LookupTags.kt");
|
||||
|
||||
Reference in New Issue
Block a user