Unwrap underlying typealias constructor earlier

The problem is very subtle (see the test): when generating a signature
for an object literal we also were mapping its super-class
(a type alias here).

Although we did unwrap its underlying constructor to map it properly
we did too late (after obtaining value parameters from the type alias constructor descriptor).

Another problem is that TypeAliasConstructorDescriptor.getOriginal
in the case does return itself, while it's expected to return
unsubstituted version

Note: everything works for common calls for such constructors
because they mapped through mapCallableMethod which contains
another custom unwrapping of type alias constructors

 #KT-16555 Fixed
This commit is contained in:
Denis Zharkov
2017-03-01 17:07:27 +03:00
parent 8761ef6694
commit 2b21280ba9
6 changed files with 56 additions and 3 deletions
@@ -0,0 +1,10 @@
open class LockFreeLinkedListNode(val s: String)
private class SendBuffered(s: String) : LockFreeLinkedListNode(s)
open class AddLastDesc2<out T : LockFreeLinkedListNode>(val node: T)
typealias AddLastDesc<T> = AddLastDesc2<T>
fun describeSendBuffered(): AddLastDesc<*> {
return object : AddLastDesc<SendBuffered>(SendBuffered("OK")) {}
}
fun box() = describeSendBuffered().node.s
@@ -0,0 +1,24 @@
@kotlin.Metadata
public class AddLastDesc2 {
private final @org.jetbrains.annotations.NotNull field node: LockFreeLinkedListNode
public method <init>(@org.jetbrains.annotations.NotNull p0: LockFreeLinkedListNode): void
public final @org.jetbrains.annotations.NotNull method getNode(): LockFreeLinkedListNode
}
@kotlin.Metadata
public class LockFreeLinkedListNode {
private final @org.jetbrains.annotations.NotNull field s: java.lang.String
public method <init>(@org.jetbrains.annotations.NotNull p0: java.lang.String): void
public final @org.jetbrains.annotations.NotNull method getS(): java.lang.String
}
@kotlin.Metadata
public final class ObjectLiteralConstructorKt {
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
public final static @org.jetbrains.annotations.NotNull method describeSendBuffered(): AddLastDesc2
}
@kotlin.Metadata
final class SendBuffered {
public method <init>(@org.jetbrains.annotations.NotNull p0: java.lang.String): void
}