Discriminate header classes in favor of non-header type aliases

In the test case, the problem was that Foo.a's type was resolved to the
_class A_, which was written to metadata on JVM instead of the class
AImpl with typealias A as an abbreviation. This metadata was incorrect
because there's no class A from the JVM compiler's point of view; that's
why the error "cannot access class A" was reported

 #KT-19151 Fixed
This commit is contained in:
Alexander Udalov
2017-07-21 00:17:42 +03:00
parent 6ee94dae6f
commit ebdf5aa223
6 changed files with 34 additions and 4 deletions
@@ -0,0 +1,3 @@
class Foo(val a: A? = null)
header class A
@@ -0,0 +1,5 @@
impl typealias A = AImpl
class AImpl {
fun jvm(): A = this
}
@@ -0,0 +1 @@
val a = Foo().a?.jvm()
@@ -0,0 +1,11 @@
-- Common --
Exit code: OK
Output:
-- JVM --
Exit code: OK
Output:
-- JVM (2) --
Exit code: OK
Output: