提交 cd483ad2 编写于 作者: M Mikhail Glukhikh

FIR2IR: fix raw SAM conversion (avoid * in type arguments)

上级 5f3102bf
...@@ -626,7 +626,10 @@ class CallAndReferenceGenerator( ...@@ -626,7 +626,10 @@ class CallAndReferenceGenerator(
if (!needSamConversion(argument, parameter)) { if (!needSamConversion(argument, parameter)) {
return this 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() var samType = samFirType?.toIrType(ConversionTypeContext.WITH_INVARIANT) ?: createErrorType()
if (shouldUnwrapVarargType) { if (shouldUnwrapVarargType) {
samType = samType.getArrayElementType(irBuiltIns) samType = samType.getArrayElementType(irBuiltIns)
......
...@@ -14882,6 +14882,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT ...@@ -14882,6 +14882,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/fir/IrBuiltIns.kt"); 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 @Test
@TestMetadata("LookupTags.kt") @TestMetadata("LookupTags.kt")
public void testLookupTags() throws Exception { public void testLookupTags() throws Exception {
// 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")) {
}
}
...@@ -14882,6 +14882,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { ...@@ -14882,6 +14882,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/fir/IrBuiltIns.kt"); 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 @Test
@TestMetadata("LookupTags.kt") @TestMetadata("LookupTags.kt")
public void testLookupTags() throws Exception { public void testLookupTags() throws Exception {
...@@ -14882,6 +14882,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes ...@@ -14882,6 +14882,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
runTest("compiler/testData/codegen/box/fir/IrBuiltIns.kt"); 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 @Test
@TestMetadata("LookupTags.kt") @TestMetadata("LookupTags.kt")
public void testLookupTags() throws Exception { public void testLookupTags() throws Exception {
...@@ -12308,6 +12308,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes ...@@ -12308,6 +12308,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
runTest("compiler/testData/codegen/box/fir/IrBuiltIns.kt"); 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") @TestMetadata("LookupTags.kt")
public void testLookupTags() throws Exception { public void testLookupTags() throws Exception {
runTest("compiler/testData/codegen/box/fir/LookupTags.kt"); runTest("compiler/testData/codegen/box/fir/LookupTags.kt");
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册