FIR Checker: check AMBIGUOUS_ANONYMOUS_TYPE_INFERRED

Also change
org.jetbrains.kotlin.fir.types.TypeUtilsKt#hideLocalTypeIfNeeded to skip
approximating anonymous objects if there are multiple super type refs so
that resolution behaves the same (for uncompilable code).

Note that this change does not implement check for
ApproximateAnonymousReturnTypesInPrivateInlineFunctions as the check is
already turned on in 1.5 and will likely not needed when FIR becomes
stable.
This commit is contained in:
Tianyu Geng
2021-09-01 13:30:02 -07:00
committed by teamcityserver
parent 6432388778
commit 76e192fc8a
14 changed files with 149 additions and 72 deletions
@@ -714,6 +714,9 @@ object DIAGNOSTICS_LIST : DiagnosticList("FirErrors") {
parameter<FirClassSymbol<*>>("classOrObject")
parameter<FirCallableSymbol<*>>("invisibleDeclaration")
}
val AMBIGUOUS_ANONYMOUS_TYPE_INFERRED by error<KtDeclaration>(PositioningStrategy.DECLARATION_SIGNATURE) {
parameter<Collection<ConeKotlinType>>("superTypes")
}
val MANY_IMPL_MEMBER_NOT_IMPLEMENTED by error<KtClassOrObject>(PositioningStrategy.DECLARATION_NAME) {
parameter<FirClassSymbol<*>>("classOrObject")
parameter<FirCallableSymbol<*>>("missingDeclaration")