Discriminate header class in resolution from sources in AbstractLazyMemberScope

Similarly to getFirstClassifierDiscriminateHeaders, we select the first
non-header class if possible, otherwise we select just the first class.
This makes sure that a reference will never be resolved to a header
class if the corresponding impl class is present.

Note that overall the issue may not be fixed yet, because there are
other scopes where header classes are not yet discriminated
(LazyImportScope, DeserializedMemberScope). However, at this point I
cannot reproduce this problem with these other scopes

 #KT-15521 Fixed
This commit is contained in:
Alexander Udalov
2017-03-20 14:41:23 +03:00
parent 93e3bdc1ab
commit 81774926fa
5 changed files with 30 additions and 3 deletions
@@ -0,0 +1 @@
header class Foo
@@ -0,0 +1,7 @@
impl class Foo(x: Int) {
impl constructor() : this(0)
val x: Int = x
}
val y = Foo(42).x
@@ -0,0 +1,7 @@
-- Common --
Exit code: OK
Output:
-- JVM --
Exit code: OK
Output: