FIR: fix WRONG_GETTER(SETTER)_RETURN_TYPE associated PSI types
This commit is contained in:
+2
-2
@@ -586,8 +586,8 @@ object DIAGNOSTICS_LIST : DiagnosticList() {
|
||||
}
|
||||
val GETTER_VISIBILITY_DIFFERS_FROM_PROPERTY_VISIBILITY by error<KtModifierListOwner>(PositioningStrategy.VISIBILITY_MODIFIER)
|
||||
val SETTER_VISIBILITY_INCONSISTENT_WITH_PROPERTY_VISIBILITY by error<KtModifierListOwner>(PositioningStrategy.VISIBILITY_MODIFIER)
|
||||
val WRONG_SETTER_RETURN_TYPE by error<KtProperty>()
|
||||
val WRONG_GETTER_RETURN_TYPE by error<KtProperty> {
|
||||
val WRONG_SETTER_RETURN_TYPE by error<KtTypeReference>()
|
||||
val WRONG_GETTER_RETURN_TYPE by error<KtTypeReference> {
|
||||
parameter<ConeKotlinType>("expectedType")
|
||||
parameter<ConeKotlinType>("actualType")
|
||||
}
|
||||
|
||||
+2
-2
@@ -367,8 +367,8 @@ object FirErrors {
|
||||
val INITIALIZER_TYPE_MISMATCH by error2<KtProperty, ConeKotlinType, ConeKotlinType>(SourceElementPositioningStrategies.ASSIGNMENT_VALUE)
|
||||
val GETTER_VISIBILITY_DIFFERS_FROM_PROPERTY_VISIBILITY by error0<KtModifierListOwner>(SourceElementPositioningStrategies.VISIBILITY_MODIFIER)
|
||||
val SETTER_VISIBILITY_INCONSISTENT_WITH_PROPERTY_VISIBILITY by error0<KtModifierListOwner>(SourceElementPositioningStrategies.VISIBILITY_MODIFIER)
|
||||
val WRONG_SETTER_RETURN_TYPE by error0<KtProperty>()
|
||||
val WRONG_GETTER_RETURN_TYPE by error2<KtProperty, ConeKotlinType, ConeKotlinType>()
|
||||
val WRONG_SETTER_RETURN_TYPE by error0<KtTypeReference>()
|
||||
val WRONG_GETTER_RETURN_TYPE by error2<KtTypeReference, ConeKotlinType, ConeKotlinType>()
|
||||
val ACCESSOR_FOR_DELEGATED_PROPERTY by error0<KtPropertyAccessor>()
|
||||
|
||||
// Multi-platform projects
|
||||
|
||||
+2
-2
@@ -1219,11 +1219,11 @@ sealed class KtFirDiagnostic<PSI: PsiElement> : KtDiagnosticWithPsi<PSI> {
|
||||
override val diagnosticClass get() = SetterVisibilityInconsistentWithPropertyVisibility::class
|
||||
}
|
||||
|
||||
abstract class WrongSetterReturnType : KtFirDiagnostic<KtProperty>() {
|
||||
abstract class WrongSetterReturnType : KtFirDiagnostic<KtTypeReference>() {
|
||||
override val diagnosticClass get() = WrongSetterReturnType::class
|
||||
}
|
||||
|
||||
abstract class WrongGetterReturnType : KtFirDiagnostic<KtProperty>() {
|
||||
abstract class WrongGetterReturnType : KtFirDiagnostic<KtTypeReference>() {
|
||||
override val diagnosticClass get() = WrongGetterReturnType::class
|
||||
abstract val expectedType: KtType
|
||||
abstract val actualType: KtType
|
||||
|
||||
+2
-2
@@ -1988,7 +1988,7 @@ internal class SetterVisibilityInconsistentWithPropertyVisibilityImpl(
|
||||
internal class WrongSetterReturnTypeImpl(
|
||||
firDiagnostic: FirPsiDiagnostic<*>,
|
||||
override val token: ValidityToken,
|
||||
) : KtFirDiagnostic.WrongSetterReturnType(), KtAbstractFirDiagnostic<KtProperty> {
|
||||
) : KtFirDiagnostic.WrongSetterReturnType(), KtAbstractFirDiagnostic<KtTypeReference> {
|
||||
override val firDiagnostic: FirPsiDiagnostic<*> by weakRef(firDiagnostic)
|
||||
}
|
||||
|
||||
@@ -1997,7 +1997,7 @@ internal class WrongGetterReturnTypeImpl(
|
||||
override val actualType: KtType,
|
||||
firDiagnostic: FirPsiDiagnostic<*>,
|
||||
override val token: ValidityToken,
|
||||
) : KtFirDiagnostic.WrongGetterReturnType(), KtAbstractFirDiagnostic<KtProperty> {
|
||||
) : KtFirDiagnostic.WrongGetterReturnType(), KtAbstractFirDiagnostic<KtTypeReference> {
|
||||
override val firDiagnostic: FirPsiDiagnostic<*> by weakRef(firDiagnostic)
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -5,7 +5,7 @@ class A() {
|
||||
field = value
|
||||
}
|
||||
val y: Int
|
||||
get(): String = "s"
|
||||
get(): <error descr="[WRONG_GETTER_RETURN_TYPE] Getter return type must be equal to the type of the property, i.e. 'kotlin/Int'">String</error> = "s"
|
||||
val z: Int
|
||||
get() {
|
||||
return "s"
|
||||
@@ -16,7 +16,7 @@ class A() {
|
||||
field = v
|
||||
}
|
||||
val b: Int
|
||||
get(): Any = "s"
|
||||
get(): <error descr="[WRONG_GETTER_RETURN_TYPE] Getter return type must be equal to the type of the property, i.e. 'kotlin/Int'">Any</error> = "s"
|
||||
val c: Int
|
||||
get() {
|
||||
return 1
|
||||
@@ -26,7 +26,7 @@ class A() {
|
||||
return field
|
||||
}
|
||||
val e = 1
|
||||
get(): String {
|
||||
get(): <error descr="[WRONG_GETTER_RETURN_TYPE] Getter return type must be equal to the type of the property, i.e. 'kotlin/Int'">String</error> {
|
||||
return field
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user