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:
+8
-4
@@ -69,13 +69,17 @@ protected constructor(
|
||||
// NB we should resolve type alias descriptors even if a class descriptor with corresponding name is present
|
||||
val classes = classDescriptors(name)
|
||||
val typeAliases = typeAliasDescriptors(name)
|
||||
var resultingClass: ClassDescriptor? = null
|
||||
// See getFirstClassifierDiscriminateHeaders()
|
||||
var result: ClassifierDescriptor? = null
|
||||
for (klass in classes) {
|
||||
// See getFirstClassifierDiscriminateHeaders()
|
||||
if (!klass.isHeader) return klass
|
||||
if (resultingClass == null) resultingClass = klass
|
||||
if (result == null) result = klass
|
||||
}
|
||||
return resultingClass ?: typeAliases.firstOrNull()
|
||||
for (typeAlias in typeAliases) {
|
||||
if (!typeAlias.isHeader) return typeAlias
|
||||
if (result == null) result = typeAlias
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
override fun getContributedFunctions(name: Name, location: LookupLocation): Collection<SimpleFunctionDescriptor> {
|
||||
|
||||
Reference in New Issue
Block a user