FIR: regard implicit type for value parameter after body resolve as an error type
This commit is contained in:
committed by
Mikhail Glukhikh
parent
fbb19e3b50
commit
9aaa952b39
+2
-6
@@ -13,7 +13,7 @@ import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors
|
||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.reportOn
|
||||
import org.jetbrains.kotlin.fir.expressions.FirTryExpression
|
||||
import org.jetbrains.kotlin.fir.types.ConeTypeParameterType
|
||||
import org.jetbrains.kotlin.fir.types.FirResolvedTypeRef
|
||||
import org.jetbrains.kotlin.fir.types.coneType
|
||||
|
||||
object FirCatchParameterChecker : FirTryExpressionChecker() {
|
||||
override fun check(expression: FirTryExpression, context: CheckerContext, reporter: DiagnosticReporter) {
|
||||
@@ -24,11 +24,7 @@ object FirCatchParameterChecker : FirTryExpressionChecker() {
|
||||
reporter.reportOn(catchParameter.source, FirErrors.CATCH_PARAMETER_WITH_DEFAULT_VALUE, context)
|
||||
}
|
||||
|
||||
val typeRef = catchParameter.returnTypeRef
|
||||
// TODO: remaining implicit types should be resolved as an error type, along with proper error kind, most likely syntax error.
|
||||
if (typeRef !is FirResolvedTypeRef) return
|
||||
|
||||
val coneType = typeRef.type
|
||||
val coneType = catchParameter.returnTypeRef.coneType
|
||||
if (coneType is ConeTypeParameterType) {
|
||||
val isReified = coneType.lookupTag.typeParameterSymbol.fir.isReified
|
||||
|
||||
|
||||
+1
-1
@@ -74,7 +74,7 @@ open class FirBodyResolveTransformer(
|
||||
return (element.transformChildren(this, data) as E).compose()
|
||||
}
|
||||
|
||||
override fun transformTypeRef(typeRef: FirTypeRef, data: ResolutionMode): CompositeTransformResult<FirTypeRef> {
|
||||
override fun transformTypeRef(typeRef: FirTypeRef, data: ResolutionMode): CompositeTransformResult<FirResolvedTypeRef> {
|
||||
if (typeRef is FirResolvedTypeRef) {
|
||||
return typeRef.compose()
|
||||
}
|
||||
|
||||
+3
@@ -704,6 +704,9 @@ open class FirDeclarationsResolveTransformer(transformer: FirBodyResolveTransfor
|
||||
context.storeVariable(valueParameter)
|
||||
if (valueParameter.returnTypeRef is FirImplicitTypeRef) {
|
||||
transformer.replaceDeclarationResolvePhaseIfNeeded(valueParameter, transformerPhase)
|
||||
valueParameter.replaceReturnTypeRef(
|
||||
valueParameter.returnTypeRef.errorTypeFromPrototype(ConeSimpleDiagnostic("Unresolved value parameter type"))
|
||||
)
|
||||
return valueParameter.compose()
|
||||
}
|
||||
|
||||
|
||||
+1
@@ -12,3 +12,4 @@ fun foo(@inlineOptions(<caret>) { }
|
||||
// EXIST: InlineOption
|
||||
// EXIST: String
|
||||
// EXIST: v
|
||||
// FIR_COMPARISON
|
||||
|
||||
Reference in New Issue
Block a user