FIR: do not run full tower resolve on integer literal type

This commit is contained in:
Mikhail Glukhikh
2019-12-19 14:57:14 +03:00
parent cb3f02d015
commit 99643e1b2d
3 changed files with 9 additions and 3 deletions
@@ -137,7 +137,8 @@ class FirCallResolver(
val result = towerResolver.runResolver(
consumer,
implicitReceiverStack.receiversAsReversed(),
shouldProcessExtensionsBeforeMembers = name in HIDES_MEMBERS_NAME_LIST
shouldProcessExtensionsBeforeMembers = name in HIDES_MEMBERS_NAME_LIST,
shouldProcessExplicitReceiverScopeOnly = explicitReceiver?.typeRef?.coneTypeSafe<ConeIntegerLiteralType>() != null
)
val bestCandidates = result.bestCandidates()
val reducedCandidates = if (result.currentApplicability < CandidateApplicability.SYNTHETIC_RESOLVED) {
@@ -184,7 +184,8 @@ class FirTowerResolver(
fun runResolver(
consumer: TowerDataConsumer,
implicitReceiverValues: List<ImplicitReceiverValue<*>>,
shouldProcessExtensionsBeforeMembers: Boolean = false
shouldProcessExtensionsBeforeMembers: Boolean = false,
shouldProcessExplicitReceiverScopeOnly: Boolean = false
): CandidateCollector {
this.implicitReceiverValues = implicitReceiverValues
towerDataConsumer = consumer
@@ -203,6 +204,10 @@ class FirTowerResolver(
// fun test(f: Foo) { f.x }
towerDataConsumer.consume(EMPTY, TowerScopeLevel.Empty, group++)
if (shouldProcessExplicitReceiverScopeOnly) {
return collector
}
// Member of local scope
// fun test(x: Int) = x
val nonEmptyLocalScopes = mutableListOf<FirLocalScope>()
@@ -5,7 +5,7 @@ fun foo() = 1
val nonConst = foo()
annotation class ValidAnn(
val p1: Int = 1 <!AMBIGUITY!>+<!> CONST,
val p1: Int = 1 + CONST,
val p2: String = "",
val p3: KClass<*> = String::class,
val p4: IntArray = intArrayOf(1, 2, 3),