FIR resolve: fix constructor handling in qualifier scope
Constructors aren't more visited twice in regular scopes
This commit is contained in:
@@ -238,7 +238,10 @@ class QualifiedReceiverTowerLevel(
|
|||||||
|
|
||||||
val processorForCallables: (FirCallableSymbol<*>) -> ProcessorAction = {
|
val processorForCallables: (FirCallableSymbol<*>) -> ProcessorAction = {
|
||||||
val fir = it.fir
|
val fir = it.fir
|
||||||
if (fir is FirCallableMemberDeclaration<*> && fir.isStatic || it.callableId.classId == null) {
|
if (fir is FirCallableMemberDeclaration<*> && fir.isStatic ||
|
||||||
|
it.callableId.classId == null ||
|
||||||
|
fir is FirConstructor && !fir.isInner
|
||||||
|
) {
|
||||||
@Suppress("UNCHECKED_CAST")
|
@Suppress("UNCHECKED_CAST")
|
||||||
processor.consumeCandidate(it as T, null, null)
|
processor.consumeCandidate(it as T, null, null)
|
||||||
} else {
|
} else {
|
||||||
@@ -300,7 +303,10 @@ private fun FirScope.processFunctionsAndConstructorsByName(
|
|||||||
return ProcessorAction.STOP
|
return ProcessorAction.STOP
|
||||||
}
|
}
|
||||||
|
|
||||||
return processFunctionsByName(name, processor)
|
return processFunctionsByName(name) {
|
||||||
|
if (it is FirConstructorSymbol) ProcessorAction.NEXT
|
||||||
|
else processor(it)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun FirScope.getFirstClassifierOrNull(name: Name): FirClassifierSymbol<*>? {
|
private fun FirScope.getFirstClassifierOrNull(name: Name): FirClassifierSymbol<*>? {
|
||||||
|
|||||||
+2
-2
@@ -40,6 +40,6 @@ FILE: simple.kt
|
|||||||
public final fun test(): R|kotlin/Unit| {
|
public final fun test(): R|kotlin/Unit| {
|
||||||
lval o: R|Owner| = R|/Owner.Owner|()
|
lval o: R|Owner| = R|/Owner.Owner|()
|
||||||
R|<local>/o|.R|/Owner.foo|()
|
R|<local>/o|.R|/Owner.foo|()
|
||||||
lval n: <ERROR TYPE REF: Unresolved name: Nested> = Q|Owner|.<Unresolved name: Nested>#()
|
lval n: R|Owner.Nested| = Q|Owner|.R|/Owner.Nested.Nested|()
|
||||||
R|<local>/n|.<Unresolved name: baz>#()
|
R|<local>/n|.R|/Owner.Nested.baz|()
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -61,7 +61,7 @@ FILE: problems2.kt
|
|||||||
|
|
||||||
}
|
}
|
||||||
public final fun test(): R|kotlin/Unit| {
|
public final fun test(): R|kotlin/Unit| {
|
||||||
Q|Some|.<Unresolved name: WithPrimary>#(Int(42), R?C|kotlin/arrayOf|(String(alpha), String(omega)))
|
Q|Some|.R|/Some.WithPrimary.WithPrimary|(Int(42), R|kotlin/arrayOf|<R|kotlin/String|>(String(alpha), String(omega)))
|
||||||
}
|
}
|
||||||
public final class KonanTarget : R|kotlin/Any| {
|
public final class KonanTarget : R|kotlin/Any| {
|
||||||
public constructor(name: R|kotlin/String|): R|KonanTarget| {
|
public constructor(name: R|kotlin/String|): R|KonanTarget| {
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ FILE fqName:<root> fileName:/objectAsCallable.kt
|
|||||||
PROPERTY name:test2 visibility:public modality:FINAL [val]
|
PROPERTY name:test2 visibility:public modality:FINAL [val]
|
||||||
FIELD PROPERTY_BACKING_FIELD name:test2 type:IrErrorType visibility:private [final,static]
|
FIELD PROPERTY_BACKING_FIELD name:test2 type:IrErrorType visibility:private [final,static]
|
||||||
EXPRESSION_BODY
|
EXPRESSION_BODY
|
||||||
ERROR_CALL 'Unresolved reference: <Unresolved name: X>#' type=IrErrorType
|
ERROR_CALL 'Unresolved reference: <Inapplicable(PARAMETER_MAPPING_ERROR): [/En.X.X]>#' type=IrErrorType
|
||||||
CONST Int type=kotlin.Int value=42
|
CONST Int type=kotlin.Int value=42
|
||||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-test2> visibility:public modality:FINAL <> () returnType:IrErrorType
|
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-test2> visibility:public modality:FINAL <> () returnType:IrErrorType
|
||||||
correspondingProperty: PROPERTY name:test2 visibility:public modality:FINAL [val]
|
correspondingProperty: PROPERTY name:test2 visibility:public modality:FINAL [val]
|
||||||
|
|||||||
Reference in New Issue
Block a user