FIR: allow fun T.() = ... as an instance of (T) -> ...
It was already done by the previous commit by mistake, but it broke if there are other value parameters because the type of the first parameter would be inferred to be same as the type of the receiver.
This commit is contained in:
+6
@@ -1338,6 +1338,12 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert
|
||||
token,
|
||||
)
|
||||
}
|
||||
add(FirErrors.CANNOT_INFER_PARAMETER_TYPE) { firDiagnostic ->
|
||||
CannotInferParameterTypeImpl(
|
||||
firDiagnostic as FirPsiDiagnostic<*>,
|
||||
token,
|
||||
)
|
||||
}
|
||||
add(FirErrors.FUN_INTERFACE_CONSTRUCTOR_REFERENCE) { firDiagnostic ->
|
||||
FunInterfaceConstructorReferenceImpl(
|
||||
firDiagnostic as FirPsiDiagnostic<*>,
|
||||
|
||||
+4
@@ -949,6 +949,10 @@ sealed class KtFirDiagnostic<PSI: PsiElement> : KtDiagnosticWithPsi<PSI> {
|
||||
override val diagnosticClass get() = ValueParameterWithNoTypeAnnotation::class
|
||||
}
|
||||
|
||||
abstract class CannotInferParameterType : KtFirDiagnostic<KtParameter>() {
|
||||
override val diagnosticClass get() = CannotInferParameterType::class
|
||||
}
|
||||
|
||||
abstract class FunInterfaceConstructorReference : KtFirDiagnostic<KtExpression>() {
|
||||
override val diagnosticClass get() = FunInterfaceConstructorReference::class
|
||||
}
|
||||
|
||||
+7
@@ -1529,6 +1529,13 @@ internal class ValueParameterWithNoTypeAnnotationImpl(
|
||||
override val firDiagnostic: FirPsiDiagnostic<*> by weakRef(firDiagnostic)
|
||||
}
|
||||
|
||||
internal class CannotInferParameterTypeImpl(
|
||||
firDiagnostic: FirPsiDiagnostic<*>,
|
||||
override val token: ValidityToken,
|
||||
) : KtFirDiagnostic.CannotInferParameterType(), KtAbstractFirDiagnostic<KtParameter> {
|
||||
override val firDiagnostic: FirPsiDiagnostic<*> by weakRef(firDiagnostic)
|
||||
}
|
||||
|
||||
internal class FunInterfaceConstructorReferenceImpl(
|
||||
firDiagnostic: FirPsiDiagnostic<*>,
|
||||
override val token: ValidityToken,
|
||||
|
||||
Reference in New Issue
Block a user