FirTypeIntersectionScope: introduce "intersection" fake overrides

This commit is contained in:
Mikhail Glukhikh
2020-07-14 10:43:10 +03:00
parent 5a422b5ef6
commit 7a2ea49399
6 changed files with 59 additions and 43 deletions
@@ -447,8 +447,9 @@ class Fir2IrVisitor(
if (castTypeRef is FirResolvedTypeRef && originalTypeRef is FirResolvedTypeRef) {
val castType = castTypeRef.type
if (castType is ConeIntersectionType) {
val unwrappedSymbol = (referencedSymbol as? FirCallableSymbol)?.overriddenSymbol ?: referencedSymbol
castType.intersectedTypes.forEach {
if (it.doesContainReferencedSymbolInScope(referencedSymbol, calleeReference.name)) {
if (it.doesContainReferencedSymbolInScope(unwrappedSymbol, calleeReference.name)) {
return implicitCastOrExpression(value, it)
}
}