diff --git a/plugins/kapt3/kapt3-compiler/src/org/jetbrains/kotlin/kapt3/stubs/ErrorTypeCorrector.kt b/plugins/kapt3/kapt3-compiler/src/org/jetbrains/kotlin/kapt3/stubs/ErrorTypeCorrector.kt index 7609501558c..dc29ccd03de 100644 --- a/plugins/kapt3/kapt3-compiler/src/org/jetbrains/kotlin/kapt3/stubs/ErrorTypeCorrector.kt +++ b/plugins/kapt3/kapt3-compiler/src/org/jetbrains/kotlin/kapt3/stubs/ErrorTypeCorrector.kt @@ -94,6 +94,11 @@ class ErrorTypeCorrector( val typeAlias = target.source.getPsi() as? KtTypeAlias val actualType = typeAlias?.getTypeReference() ?: return convert(target.expandedType) return convert(actualType, typeAlias.getSubstitutions(type)) + } else if (target is ClassConstructorDescriptor) { + val asmType = converter.kaptContext.generationState.typeMapper + .mapType(target.constructedClass.defaultType, null, TypeMappingMode.GENERIC_ARGUMENT) + + baseExpression = converter.treeMaker.Type(asmType) } else if (target is ClassDescriptor) { // We only get here if some type were an error type. In other words, 'type' is either an error type or its argument, // so it's impossible it to be unboxed primitive. diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/errorSuperclassCorrectErrorTypes.kt b/plugins/kapt3/kapt3-compiler/testData/converter/errorSuperclassCorrectErrorTypes.kt index 6bedc2181d0..8f1d2b4e631 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/errorSuperclassCorrectErrorTypes.kt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/errorSuperclassCorrectErrorTypes.kt @@ -1,5 +1,6 @@ // CORRECT_ERROR_TYPES // NO_VALIDATION +// WITH_RUNTIME @file:Suppress("UNRESOLVED_REFERENCE", "DELEGATION_NOT_TO_INTERFACE", "SUPERTYPE_NOT_INITIALIZED") package test @@ -42,4 +43,9 @@ class Generics1 : Foo() class Generics2 : Foo -class Generics3 : Foo>, String> \ No newline at end of file +class Generics3 : Foo>, String> + +class MappedList() : AbstractList(), List { + override fun get(index: Int) = throw RuntimeException() + override val size get() = 0 +} \ No newline at end of file diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/errorSuperclassCorrectErrorTypes.txt b/plugins/kapt3/kapt3-compiler/testData/converter/errorSuperclassCorrectErrorTypes.txt index b8e96b020c3..fdc99fa453f 100644 --- a/plugins/kapt3/kapt3-compiler/testData/converter/errorSuperclassCorrectErrorTypes.txt +++ b/plugins/kapt3/kapt3-compiler/testData/converter/errorSuperclassCorrectErrorTypes.txt @@ -68,6 +68,31 @@ package test; import java.lang.System; +@kotlin.Metadata() +public final class MappedList extends kotlin.collections.AbstractList implements java.util.List { + + @org.jetbrains.annotations.NotNull() + @java.lang.Override() + public java.lang.Void get(int index) { + return null; + } + + @java.lang.Override() + public int getSize() { + return 0; + } + + public MappedList() { + super(); + } +} + +//////////////////// + +package test; + +import java.lang.System; + @kotlin.Metadata() public final class TBarBazCl extends test.Cl implements Bar, Baz {