[FIR] Fix reporting of TYPE_ARGUMENTS_NOT_ALLOWED instead of WRONG_NUMBER_OF_TYPE_ARGUMENTS
This commit is contained in:
committed by
Space Team
parent
42e5e43302
commit
8d27af5b0d
+2
@@ -123,6 +123,8 @@ private fun ConeDiagnostic.toKtDiagnostic(
|
||||
is ConeIllegalAnnotationError -> FirErrors.NOT_AN_ANNOTATION_CLASS.createOn(source, this.name.asString())
|
||||
is ConeWrongNumberOfTypeArgumentsError ->
|
||||
FirErrors.WRONG_NUMBER_OF_TYPE_ARGUMENTS.createOn(this.source, this.desiredCount, this.symbol)
|
||||
is ConeTypeArgumentsNotAllowedError ->
|
||||
FirErrors.TYPE_ARGUMENTS_NOT_ALLOWED.createOn(this.source)
|
||||
|
||||
is ConeOuterClassArgumentsRequired ->
|
||||
FirErrors.OUTER_CLASS_ARGUMENTS_REQUIRED.createOn(callOrAssignmentSource ?: source, this.symbol)
|
||||
|
||||
+1
-2
@@ -286,9 +286,8 @@ class FirTypeResolverImpl(private val session: FirSession) : FirTypeResolver() {
|
||||
|
||||
if (currentDeclaration == null) {
|
||||
// It's a package name
|
||||
// TODO: report TYPE_ARGUMENTS_NOT_ALLOWED instead of WRONG_NUMBER_OF_TYPE_ARGUMENTS
|
||||
if (qualifierPartArgsCount > 0) {
|
||||
return createWrongNumberOfTypeArgumentsError(0, qualifierPartIndex, symbol, typeRef)
|
||||
return ConeErrorType(ConeTypeArgumentsNotAllowedError(qualifierPart.typeArgumentList.source!!))
|
||||
}
|
||||
break
|
||||
}
|
||||
|
||||
+4
@@ -264,6 +264,10 @@ class ConeWrongNumberOfTypeArgumentsError(
|
||||
override val reason: String get() = "Wrong number of type arguments"
|
||||
}
|
||||
|
||||
class ConeTypeArgumentsNotAllowedError(source: KtSourceElement) : ConeDiagnosticWithSource(source) {
|
||||
override val reason: String get() = "Type parameters cannot be parameterized with type arguments"
|
||||
}
|
||||
|
||||
class ConeNoTypeArgumentsOnRhsError(
|
||||
override val desiredCount: Int,
|
||||
override val symbol: FirClassLikeSymbol<*>
|
||||
|
||||
+1
-1
@@ -48,4 +48,4 @@ fun error4(): Outer<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><A><!>.Nested<B>.Inner4<C>
|
||||
fun error5(): Outer<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><A><!>.Obj.Nested2<B>.Inner5<C> = null!!
|
||||
fun error6(): Outer.Obj<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><A><!>.Nested2<B>.Inner5<C> = null!!
|
||||
|
||||
fun error7(): test<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><String><!>.Outer.Obj.Nested2<A>.Inner5<B> = null!!
|
||||
fun error7(): test<!TYPE_ARGUMENTS_NOT_ALLOWED!><String><!>.Outer.Obj.Nested2<A>.Inner5<B> = null!!
|
||||
|
||||
Reference in New Issue
Block a user