Kapt: Fix 'correctErrorTypes' for primary constructor properties
This commit is contained in:
+12
-2
@@ -436,7 +436,12 @@ class ClassFileToSourceStubConverter(
|
|||||||
else
|
else
|
||||||
anonymousTypeHandler.getNonAnonymousType(descriptor) {
|
anonymousTypeHandler.getNonAnonymousType(descriptor) {
|
||||||
getNonErrorType((descriptor as? CallableDescriptor)?.returnType, RETURN_TYPE,
|
getNonErrorType((descriptor as? CallableDescriptor)?.returnType, RETURN_TYPE,
|
||||||
ktTypeProvider = { (kaptContext.origins[field]?.element as? KtVariableDeclaration)?.typeReference },
|
ktTypeProvider = {
|
||||||
|
val fieldOrigin = (kaptContext.origins[field]?.element as? KtCallableDeclaration)
|
||||||
|
?.takeIf { it !is KtFunction }
|
||||||
|
|
||||||
|
fieldOrigin?.typeReference
|
||||||
|
},
|
||||||
ifNonError = { signatureParser.parseFieldSignature(field.signature, treeMaker.Type(type)) })
|
ifNonError = { signatureParser.parseFieldSignature(field.signature, treeMaker.Type(type)) })
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -578,7 +583,12 @@ class ClassFileToSourceStubConverter(
|
|||||||
nonErrorParameterTypeProvider = { index, lazyType ->
|
nonErrorParameterTypeProvider = { index, lazyType ->
|
||||||
if (descriptor is PropertySetterDescriptor && valueParametersFromDescriptor.size == 1 && index == 0) {
|
if (descriptor is PropertySetterDescriptor && valueParametersFromDescriptor.size == 1 && index == 0) {
|
||||||
getNonErrorType(descriptor.correspondingProperty.returnType, METHOD_PARAMETER_TYPE,
|
getNonErrorType(descriptor.correspondingProperty.returnType, METHOD_PARAMETER_TYPE,
|
||||||
ktTypeProvider = { (kaptContext.origins[method]?.element as? KtVariableDeclaration)?.typeReference },
|
ktTypeProvider = {
|
||||||
|
val setterOrigin = (kaptContext.origins[method]?.element as? KtCallableDeclaration)
|
||||||
|
?.takeIf { it !is KtFunction }
|
||||||
|
|
||||||
|
setterOrigin?.typeReference
|
||||||
|
},
|
||||||
ifNonError = { lazyType() })
|
ifNonError = { lazyType() })
|
||||||
}
|
}
|
||||||
else if (descriptor is FunctionDescriptor && valueParametersFromDescriptor.size == parameters.size) {
|
else if (descriptor is FunctionDescriptor && valueParametersFromDescriptor.size == parameters.size) {
|
||||||
|
|||||||
@@ -1,17 +1,19 @@
|
|||||||
// CORRECT_ERROR_TYPES
|
// CORRECT_ERROR_TYPES
|
||||||
|
|
||||||
// EXPECTED_ERROR(10;12) cannot find symbol (Kotlin location: /errorLocationMapping.kt: (29, 5))
|
// EXPECTED_ERROR(10;12) cannot find symbol (Kotlin location: /errorLocationMapping.kt: (31, 5))
|
||||||
// EXPECTED_ERROR(12;12) cannot find symbol (Kotlin location: /errorLocationMapping.kt: (30, 5))
|
// EXPECTED_ERROR(10;19) cannot find symbol (Kotlin location: /errorLocationMapping.kt: (24, 50))
|
||||||
// EXPECTED_ERROR(27;18) cannot find symbol (Kotlin location: /errorLocationMapping.kt: (29, 5))
|
// EXPECTED_ERROR(12;12) cannot find symbol (Kotlin location: /errorLocationMapping.kt: (32, 5))
|
||||||
// EXPECTED_ERROR(33;5) cannot find symbol (Kotlin location: /errorLocationMapping.kt: (29, 5))
|
// EXPECTED_ERROR(12;34) cannot find symbol (Kotlin location: /errorLocationMapping.kt: (24, 62))
|
||||||
// EXPECTED_ERROR(35;5) cannot find symbol (Kotlin location: /errorLocationMapping.kt: (22, 34))
|
// EXPECTED_ERROR(27;18) cannot find symbol (Kotlin location: /errorLocationMapping.kt: (31, 5))
|
||||||
// EXPECTED_ERROR(36;30) cannot find symbol (Kotlin location: /errorLocationMapping.kt: (22, 34))
|
// EXPECTED_ERROR(33;5) cannot find symbol (Kotlin location: /errorLocationMapping.kt: (31, 5))
|
||||||
// EXPECTED_ERROR(38;18) cannot find symbol (Kotlin location: /errorLocationMapping.kt: (30, 5))
|
// EXPECTED_ERROR(35;5) cannot find symbol (Kotlin location: /errorLocationMapping.kt: (24, 34))
|
||||||
// EXPECTED_ERROR(44;5) cannot find symbol (Kotlin location: /errorLocationMapping.kt: (30, 5))
|
// EXPECTED_ERROR(36;30) cannot find symbol (Kotlin location: /errorLocationMapping.kt: (24, 34))
|
||||||
// EXPECTED_ERROR(54;5) cannot find symbol (Kotlin location: /errorLocationMapping.kt: (33, 5))
|
// EXPECTED_ERROR(38;18) cannot find symbol (Kotlin location: /errorLocationMapping.kt: (32, 5))
|
||||||
// EXPECTED_ERROR(5;11) cannot find symbol (Kotlin location: /errorLocationMapping.kt: (19, 1))
|
// EXPECTED_ERROR(44;5) cannot find symbol (Kotlin location: /errorLocationMapping.kt: (32, 5))
|
||||||
// EXPECTED_ERROR(60;5) cannot find symbol (Kotlin location: /errorLocationMapping.kt: (35, 5))
|
// EXPECTED_ERROR(54;5) cannot find symbol (Kotlin location: /errorLocationMapping.kt: (35, 5))
|
||||||
// EXPECTED_ERROR(73;18) cannot find symbol (Kotlin location: /errorLocationMapping.kt: (38, 5))
|
// EXPECTED_ERROR(5;11) cannot find symbol (Kotlin location: /errorLocationMapping.kt: (21, 1))
|
||||||
|
// EXPECTED_ERROR(60;5) cannot find symbol (Kotlin location: /errorLocationMapping.kt: (37, 5))
|
||||||
|
// EXPECTED_ERROR(73;18) cannot find symbol (Kotlin location: /errorLocationMapping.kt: (40, 5))
|
||||||
|
|
||||||
@file:Suppress("UNRESOLVED_REFERENCE", "ANNOTATION_PARAMETER_MUST_BE_CONST", "NON_CONST_VAL_USED_IN_CONSTANT_EXPRESSION")
|
@file:Suppress("UNRESOLVED_REFERENCE", "ANNOTATION_PARAMETER_MUST_BE_CONST", "NON_CONST_VAL_USED_IN_CONSTANT_EXPRESSION")
|
||||||
import kotlin.reflect.KClass
|
import kotlin.reflect.KClass
|
||||||
|
|||||||
@@ -36,9 +36,9 @@ public final class ErrorInConstructorParameter {
|
|||||||
@org.jetbrains.annotations.NotNull()
|
@org.jetbrains.annotations.NotNull()
|
||||||
private final java.lang.String a = null;
|
private final java.lang.String a = null;
|
||||||
@org.jetbrains.annotations.NotNull()
|
@org.jetbrains.annotations.NotNull()
|
||||||
private final error.NonExistentClass b = null;
|
private final ABC b = null;
|
||||||
@org.jetbrains.annotations.NotNull()
|
@org.jetbrains.annotations.NotNull()
|
||||||
private final java.util.List<error.NonExistentClass> c = null;
|
private final java.util.List<ABC> c = null;
|
||||||
|
|
||||||
@org.jetbrains.annotations.NotNull()
|
@org.jetbrains.annotations.NotNull()
|
||||||
@kapt.internal.KaptSignature(value = "getA()Ljava/lang/String;")
|
@kapt.internal.KaptSignature(value = "getA()Ljava/lang/String;")
|
||||||
|
|||||||
Reference in New Issue
Block a user