diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/transformations/InsertImplicitCasts.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/transformations/InsertImplicitCasts.kt index 66f317b8fd1..c88b0bd3a05 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/transformations/InsertImplicitCasts.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/transformations/InsertImplicitCasts.kt @@ -528,6 +528,7 @@ internal class InsertImplicitCasts( // This is a kludge to remove IR-based descriptors where possible. private fun KotlinType.toNonIrBased(): KotlinType { if (this !is SimpleType) return this + if (this.isError) return this val newDescriptor = constructor.declarationDescriptor?.let { if (it is IrBasedDeclarationDescriptor<*> && it.owner.symbol.hasDescriptor) it.owner.symbol.descriptor as ClassifierDescriptor diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/nonExistentClassTypesConversion.kt b/plugins/kapt3/kapt3-compiler/testData/converter/nonExistentClassTypesConversion.kt index 27f0d0cc840..c2b941aad63 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/nonExistentClassTypesConversion.kt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/nonExistentClassTypesConversion.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JVM_IR // CORRECT_ERROR_TYPES // NON_EXISTENT_CLASS // NO_VALIDATION diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/nonExistentClassTypesConversion_ir.txt b/plugins/kapt3/kapt3-compiler/testData/converter/nonExistentClassTypesConversion_ir.txt new file mode 100644 index 00000000000..d095164d167 --- /dev/null +++ b/plugins/kapt3/kapt3-compiler/testData/converter/nonExistentClassTypesConversion_ir.txt @@ -0,0 +1,303 @@ +import java.util.Calendar; +import kotlin.reflect.KClass; + +@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME) +@kotlin.Metadata() +public abstract @interface Anno { + + public abstract java.lang.Class a(); + + public abstract java.lang.Class[] b(); + + public abstract java.lang.Class[] c(); + + public abstract java.lang.Class[] d(); +} + +//////////////////// + + +import java.util.Calendar; +import kotlin.reflect.KClass; + +@kotlin.Metadata() +public final class MyType { + + public MyType() { + super(); + } +} + +//////////////////// + + +import java.util.Calendar; +import kotlin.reflect.KClass; + +@kotlin.Metadata() +@kotlin.Suppress(names = {"UNRESOLVED_REFERENCE", "ANNOTATION_ARGUMENT_MUST_BE_CONST", "NON_CONST_VAL_USED_IN_CONSTANT_EXPRESSION", "UNSUPPORTED_FEATURE"}) +public final class NonExistentClassTypesConversionKt { +} + +//////////////////// + + +import java.util.Calendar; +import kotlin.reflect.KClass; + +@Anno(a = Blah.class, b = {NoFoo1.class, NoBar1.class}, c = {NoFoo2.class, kotlin.String.class}, d = {kotlin.Boolean.class, NoBar3.class}) +@kotlin.Metadata() +public final class Test { + public ABC a; + @org.jetbrains.annotations.Nullable() + private final ABC b = null; + @org.jetbrains.annotations.Nullable() + private final java.util.List c = null; + @org.jetbrains.annotations.Nullable() + private final java.util.List>>> d = null; + public java.util.List> e; + public ABC f; + public java.util.List g; + public ABC h; + public Function2, CDE> i; + public Function0 j; + public Function2, CDE> k; + public ABC.BCD.EFG l; + public ABC coocoo; + public ABC coocoo2; + public ABC coocoo21; + public ABC coocoo3; + public ABC> coocoo31; + public ABC nested; + @org.jetbrains.annotations.NotNull() + private final java.lang.Object m = null; + @org.jetbrains.annotations.NotNull() + private final java.lang.String n = ""; + public java.util.List>>>>>>>>> o11; + public java.util.List>>>>>>>> o10; + public java.util.Calendar.Builder p; + + public Test() { + super(); + } + + @org.jetbrains.annotations.NotNull() + public final ABC getA() { + return null; + } + + public final void setA(@org.jetbrains.annotations.NotNull() + ABC p0) { + } + + @org.jetbrains.annotations.Nullable() + public final ABC getB() { + return null; + } + + @org.jetbrains.annotations.Nullable() + public final java.util.List getC() { + return null; + } + + @org.jetbrains.annotations.Nullable() + public final java.util.List>>> getD() { + return null; + } + + @org.jetbrains.annotations.NotNull() + public final java.util.List> getE() { + return null; + } + + public final void setE(@org.jetbrains.annotations.NotNull() + java.util.List> p0) { + } + + @org.jetbrains.annotations.NotNull() + public final ABC getF() { + return null; + } + + public final void setF(@org.jetbrains.annotations.NotNull() + ABC p0) { + } + + @org.jetbrains.annotations.NotNull() + public final java.util.List getG() { + return null; + } + + public final void setG(@org.jetbrains.annotations.NotNull() + java.util.List p0) { + } + + @org.jetbrains.annotations.NotNull() + public final ABC getH() { + return null; + } + + public final void setH(@org.jetbrains.annotations.NotNull() + ABC p0) { + } + + @org.jetbrains.annotations.NotNull() + public final Function2, CDE> getI() { + return null; + } + + public final void setI(@org.jetbrains.annotations.NotNull() + Function2, CDE> p0) { + } + + @org.jetbrains.annotations.NotNull() + public final Function0 getJ() { + return null; + } + + public final void setJ(@org.jetbrains.annotations.NotNull() + Function0 p0) { + } + + @org.jetbrains.annotations.NotNull() + public final Function2, CDE> getK() { + return null; + } + + public final void setK(@org.jetbrains.annotations.NotNull() + Function2, CDE> p0) { + } + + @org.jetbrains.annotations.NotNull() + public final ABC.BCD.EFG getL() { + return null; + } + + public final void setL(@org.jetbrains.annotations.NotNull() + ABC.BCD.EFG p0) { + } + + @org.jetbrains.annotations.NotNull() + public final ABC getCoocoo() { + return null; + } + + public final void setCoocoo(@org.jetbrains.annotations.NotNull() + ABC p0) { + } + + @org.jetbrains.annotations.NotNull() + public final ABC getCoocoo2() { + return null; + } + + public final void setCoocoo2(@org.jetbrains.annotations.NotNull() + ABC p0) { + } + + @org.jetbrains.annotations.NotNull() + public final ABC getCoocoo21() { + return null; + } + + public final void setCoocoo21(@org.jetbrains.annotations.NotNull() + ABC p0) { + } + + @org.jetbrains.annotations.NotNull() + public final ABC getCoocoo3() { + return null; + } + + public final void setCoocoo3(@org.jetbrains.annotations.NotNull() + ABC p0) { + } + + @org.jetbrains.annotations.NotNull() + public final ABC> getCoocoo31() { + return null; + } + + public final void setCoocoo31(@org.jetbrains.annotations.NotNull() + ABC> p0) { + } + + @org.jetbrains.annotations.NotNull() + public final ABC getNested() { + return null; + } + + public final void setNested(@org.jetbrains.annotations.NotNull() + ABC p0) { + } + + @org.jetbrains.annotations.NotNull() + public final java.lang.Object getM() { + return null; + } + + @org.jetbrains.annotations.NotNull() + public final java.lang.String getN() { + return null; + } + + @org.jetbrains.annotations.NotNull() + public final java.util.List>>>>>>>>> getO11() { + return null; + } + + public final void setO11(@org.jetbrains.annotations.NotNull() + java.util.List>>>>>>>>> p0) { + } + + @org.jetbrains.annotations.NotNull() + public final java.util.List>>>>>>>> getO10() { + return null; + } + + public final void setO10(@org.jetbrains.annotations.NotNull() + java.util.List>>>>>>>> p0) { + } + + @org.jetbrains.annotations.NotNull() + public final java.util.Calendar.Builder getP() { + return null; + } + + public final void setP(@org.jetbrains.annotations.NotNull() + java.util.Calendar.Builder p0) { + } + + @org.jetbrains.annotations.Nullable() + public final BCD f1(@org.jetbrains.annotations.NotNull() + ABC a) { + return null; + } + + public final void f2(@org.jetbrains.annotations.NotNull() + ABC> a) { + } + + public final long f3(@org.jetbrains.annotations.NotNull() + ABC a, int b) { + return 0L; + } + + @org.jetbrains.annotations.NotNull() + public final java.lang.Object f4() { + return null; + } + + @org.jetbrains.annotations.Nullable() + public final java.lang.Class> f5(@org.jetbrains.annotations.NotNull() + MyType $this$f5) { + return null; + } +} + +//////////////////// + +package error; + +public final class NonExistentClass { +}