Kapt: Fix error type correction for super class constructor calls
This commit is contained in:
+5
@@ -94,6 +94,11 @@ class ErrorTypeCorrector(
|
|||||||
val typeAlias = target.source.getPsi() as? KtTypeAlias
|
val typeAlias = target.source.getPsi() as? KtTypeAlias
|
||||||
val actualType = typeAlias?.getTypeReference() ?: return convert(target.expandedType)
|
val actualType = typeAlias?.getTypeReference() ?: return convert(target.expandedType)
|
||||||
return convert(actualType, typeAlias.getSubstitutions(type))
|
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) {
|
} 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,
|
// 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.
|
// so it's impossible it to be unboxed primitive.
|
||||||
|
|||||||
+7
-1
@@ -1,5 +1,6 @@
|
|||||||
// CORRECT_ERROR_TYPES
|
// CORRECT_ERROR_TYPES
|
||||||
// NO_VALIDATION
|
// NO_VALIDATION
|
||||||
|
// WITH_RUNTIME
|
||||||
|
|
||||||
@file:Suppress("UNRESOLVED_REFERENCE", "DELEGATION_NOT_TO_INTERFACE", "SUPERTYPE_NOT_INITIALIZED")
|
@file:Suppress("UNRESOLVED_REFERENCE", "DELEGATION_NOT_TO_INTERFACE", "SUPERTYPE_NOT_INITIALIZED")
|
||||||
package test
|
package test
|
||||||
@@ -42,4 +43,9 @@ class Generics1 : Foo<String>()
|
|||||||
|
|
||||||
class Generics2 : Foo<String>
|
class Generics2 : Foo<String>
|
||||||
|
|
||||||
class Generics3 : Foo<Bar, Baz, Boo<Baz, List<*>>, String>
|
class Generics3 : Foo<Bar, Baz, Boo<Baz, List<*>>, String>
|
||||||
|
|
||||||
|
class MappedList<R>() : AbstractList<R>(), List<R> {
|
||||||
|
override fun get(index: Int) = throw RuntimeException()
|
||||||
|
override val size get() = 0
|
||||||
|
}
|
||||||
+25
@@ -68,6 +68,31 @@ package test;
|
|||||||
|
|
||||||
import java.lang.System;
|
import java.lang.System;
|
||||||
|
|
||||||
|
@kotlin.Metadata()
|
||||||
|
public final class MappedList<R extends java.lang.Object> extends kotlin.collections.AbstractList<R> implements java.util.List<? extends R> {
|
||||||
|
|
||||||
|
@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()
|
@kotlin.Metadata()
|
||||||
public final class TBarBazCl extends test.Cl implements Bar, Baz {
|
public final class TBarBazCl extends test.Cl implements Bar, Baz {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user