FIR: report NO_TYPE_ARGUMENTS_ON_RHS properly
This commit is contained in:
+13
-1
@@ -70,10 +70,22 @@ class ConeIllegalAnnotationError(val name: Name) : ConeDiagnostic() {
|
||||
override val reason: String get() = "Not a legal annotation: $name"
|
||||
}
|
||||
|
||||
class ConeWrongNumberOfTypeArgumentsError(val desiredCount: Int, val type: FirClassLikeSymbol<*>) : ConeDiagnostic() {
|
||||
abstract class ConeUnmatchedTypeArgumentsError(val desiredCount: Int, val type: FirClassLikeSymbol<*>) : ConeDiagnostic()
|
||||
|
||||
class ConeWrongNumberOfTypeArgumentsError(
|
||||
desiredCount: Int,
|
||||
type: FirClassLikeSymbol<*>
|
||||
) : ConeUnmatchedTypeArgumentsError(desiredCount, type) {
|
||||
override val reason: String get() = "Wrong number of type arguments"
|
||||
}
|
||||
|
||||
class ConeNoTypeArgumentsOnRhsError(
|
||||
desiredCount: Int,
|
||||
type: FirClassLikeSymbol<*>
|
||||
) : ConeUnmatchedTypeArgumentsError(desiredCount, type) {
|
||||
override val reason: String get() = "No type arguments on RHS"
|
||||
}
|
||||
|
||||
class ConeInstanceAccessBeforeSuperCall(val target: String) : ConeDiagnostic() {
|
||||
override val reason: String get() = "Cannot access ''${target}'' before superclass constructor has been called"
|
||||
}
|
||||
|
||||
+1
-1
@@ -502,7 +502,7 @@ open class FirExpressionsResolveTransformer(transformer: FirBodyResolveTransform
|
||||
val originalType = argument.typeRef.coneTypeSafe<ConeKotlinType>() ?: return this
|
||||
val newType = computeRepresentativeTypeForBareType(type, originalType) ?: return buildErrorTypeRef {
|
||||
source = this@withTypeArgumentsForBareType.source
|
||||
diagnostic = ConeWrongNumberOfTypeArgumentsError(firClass.typeParameters.size, firClass.symbol)
|
||||
diagnostic = ConeNoTypeArgumentsOnRhsError(firClass.typeParameters.size, firClass.symbol)
|
||||
}
|
||||
return if (newType.typeArguments.isEmpty()) this else withReplacedConeType(newType)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user