[FIR] Fix stopping in AbstractFirUseSiteMemberScope

This commit is contained in:
Dmitriy Novozhilov
2019-11-25 12:14:46 +03:00
parent 52caa6a58d
commit 98af866417
4 changed files with 127 additions and 1 deletions
@@ -43,7 +43,7 @@ abstract class AbstractFirUseSiteMemberScope(
processor: (FirClassifierSymbol<*>) -> ProcessorAction
): ProcessorAction {
if (!declaredMemberScope.processClassifiersByName(name, processor)) {
return ProcessorAction.NEXT
return ProcessorAction.STOP
}
return superTypesScope.processClassifiersByName(name, processor)
}
@@ -0,0 +1,41 @@
fun <T> listOf(): List<T> = <!UNRESOLVED_REFERENCE!>null!!<!>
fun <T> materialize(): T = <!UNRESOLVED_REFERENCE!>null!!<!>
class Result
class Foo {
fun test_0() {
val result = materialize<Result>()
saveResult(result)
}
fun test_1() {
val results = listOf<Result>()
saveResults(results)
}
fun test_2(results: List<Result>) {
saveResults(results)
}
fun test_3(result: Result) {
saveResult(result)
}
fun test_4() {
val result = getResult()
saveResult(result)
}
fun test_5() {
val result = Result()
saveResult(result)
}
private fun getResult(): Result = Result()
private fun saveResults(results: List<Result>) {}
private fun saveResult(result: Result) {}
class Result
}
@@ -0,0 +1,80 @@
FILE: nestedClassNameClash.kt
public final fun <T> listOf(): R|kotlin/collections/List<T>| {
^listOf when (lval <bangbang>: R|kotlin/Nothing?| = Null(null)) {
==($subj$, Null(null)) -> {
throw <Unresolved name: KotlinNullPointerException>#()
}
else -> {
R|<local>/<bangbang>|
}
}
}
public final fun <T> materialize(): R|T| {
^materialize when (lval <bangbang>: R|kotlin/Nothing?| = Null(null)) {
==($subj$, Null(null)) -> {
throw <Unresolved name: KotlinNullPointerException>#()
}
else -> {
R|<local>/<bangbang>|
}
}
}
public final class Result : R|kotlin/Any| {
public constructor(): R|Result| {
super<R|kotlin/Any|>()
}
}
public final class Foo : R|kotlin/Any| {
public constructor(): R|Foo| {
super<R|kotlin/Any|>()
}
public final fun test_0(): R|kotlin/Unit| {
lval result: R|Foo.Result| = R|/materialize|<R|Foo.Result|>()
this@R|/Foo|.R|/Foo.saveResult|(R|<local>/result|)
}
public final fun test_1(): R|kotlin/Unit| {
lval results: R|kotlin/collections/List<Foo.Result>| = R|/listOf|<R|Foo.Result|>()
this@R|/Foo|.R|/Foo.saveResults|(R|<local>/results|)
}
public final fun test_2(results: R|kotlin/collections/List<Foo.Result>|): R|kotlin/Unit| {
this@R|/Foo|.R|/Foo.saveResults|(R|<local>/results|)
}
public final fun test_3(result: R|Foo.Result|): R|kotlin/Unit| {
this@R|/Foo|.R|/Foo.saveResult|(R|<local>/result|)
}
public final fun test_4(): R|kotlin/Unit| {
lval result: R|Foo.Result| = this@R|/Foo|.R|/Foo.getResult|()
this@R|/Foo|.R|/Foo.saveResult|(R|<local>/result|)
}
public final fun test_5(): R|kotlin/Unit| {
lval result: R|Foo.Result| = R|/Foo.Result.Result|()
this@R|/Foo|.R|/Foo.saveResult|(R|<local>/result|)
}
private final fun getResult(): R|Foo.Result| {
^getResult R|/Foo.Result.Result|()
}
private final fun saveResults(results: R|kotlin/collections/List<Foo.Result>|): R|kotlin/Unit| {
}
private final fun saveResult(result: R|Foo.Result|): R|kotlin/Unit| {
}
public final class Result : R|kotlin/Any| {
public constructor(): R|Foo.Result| {
super<R|kotlin/Any|>()
}
}
}
@@ -133,6 +133,11 @@ public class FirDiagnosticsTestGenerated extends AbstractFirDiagnosticsTest {
runTest("compiler/fir/resolve/testData/resolve/nestedClass.kt");
}
@TestMetadata("nestedClassNameClash.kt")
public void testNestedClassNameClash() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/nestedClassNameClash.kt");
}
@TestMetadata("NestedOfAliasedType.kt")
public void testNestedOfAliasedType() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/NestedOfAliasedType.kt");