[FIR] Don't analyze properties with implicit types twice

Test `cast.kt` now don't work absolutely correct and implicit type of
  value parameter in lambda is't replaced with error type, but it's
  minor bug
This commit is contained in:
Dmitriy Novozhilov
2019-08-19 17:03:43 +03:00
parent f1e56c4b3e
commit d841090866
3 changed files with 4 additions and 6 deletions
@@ -578,9 +578,6 @@ open class FirBodyResolveTransformer(
return super.transformPropertyAccessor(propertyAccessor, data)
}
val returnTypeRef = propertyAccessor.returnTypeRef
if (returnTypeRef !is FirImplicitTypeRef && implicitTypeOnly) {
return propertyAccessor.compose()
}
if (returnTypeRef is FirImplicitTypeRef && data !is FirResolvedTypeRef) {
propertyAccessor.transformReturnTypeRef(StoreType, FirComputingImplicitTypeRef)
}
@@ -639,8 +636,8 @@ open class FirBodyResolveTransformer(
enhancedTypeRef = returnTypeRef
}
setter?.let {
it.transform<FirDeclaration, Any?>(this@FirBodyResolveTransformer, enhancedTypeRef)
it.valueParameters[0].transformReturnTypeRef(StoreType, enhancedTypeRef)
it.transform<FirDeclaration, Any?>(this@FirBodyResolveTransformer, enhancedTypeRef)
}
}
@@ -674,6 +671,7 @@ open class FirBodyResolveTransformer(
override fun transformProperty(property: FirProperty, data: Any?): CompositeTransformResult<FirDeclaration> {
val returnTypeRef = property.returnTypeRef
if (returnTypeRef !is FirImplicitTypeRef && implicitTypeOnly) return property.compose()
if (property.resolvePhase == transformerPhase) return property.compose()
if (returnTypeRef is FirImplicitTypeRef) {
property.transformReturnTypeRef(StoreType, FirComputingImplicitTypeRef)
}
+1 -1
View File
@@ -18,7 +18,7 @@ FILE: cast.kt
}
public get(): R|kotlin/Function1<kotlin/String, kotlin/Boolean>|
public final val hError: R|kotlin/Function1<class error: No type for parameter, kotlin/Boolean>| = fun <anonymous>(_: R|class error: No type for parameter|): R|kotlin/Boolean| {
public final val hError: R|kotlin/Function1<class error: No type for parameter, kotlin/Boolean>| = fun <anonymous>(_: <implicit>): R|kotlin/Boolean| {
Boolean(true)
}
+1 -1
View File
@@ -5,7 +5,7 @@ FILE fqName:<root> fileName:/justLambda.kt
FUN_EXPR type=kotlin.Function0<kotlin.Int> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.Int
BLOCK_BODY
CONST Int type=kotlin.Function0<kotlin.Int> value=42
CONST Int type=kotlin.Int value=42
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-test1> visibility:public modality:FINAL <> () returnType:kotlin.Function0<kotlin.Int>
correspondingProperty: PROPERTY name:test1 visibility:public modality:FINAL [val]
BLOCK_BODY