Make type aliases constructors return correct original descriptors
The problem was that when resolving super-calls we used known substitutor when creating a type alias constructor, thus its original return itself, while it's expected that it should return the descriptor before substitution The main idea of the fix that `createIfAvailable` should always return unsubstituted constructor. Note that known substitutor for type alias constructor should be based on abbreviation. The test change seems to be correct as PROJECTION_IN_IMMEDIATE_ARGUMENT_TO_SUPERTYPE is already reported. Beside this, resolution behavior isn't expected to be changed dramatically
This commit is contained in:
@@ -4320,6 +4320,8 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
||||
private static ReceiverValue getConstructorReceiver(@NotNull ResolvedCall<?> resolvedCall) {
|
||||
CallableDescriptor constructor = resolvedCall.getResultingDescriptor();
|
||||
if (constructor.getExtensionReceiverParameter() != null) {
|
||||
// see comment on `withDispatchReceiver` parameter in
|
||||
// org.jetbrains.kotlin.descriptors.impl.TypeAliasConstructorDescriptorImpl.Companion.createIfAvailable
|
||||
assert constructor instanceof TypeAliasConstructorDescriptor :
|
||||
"Only type alias constructor can have an extension receiver: " + constructor;
|
||||
return resolvedCall.getExtensionReceiver();
|
||||
|
||||
Reference in New Issue
Block a user