Fix for KT-11634: UOE in ConstructorContext.getOuterExpression for super call in delegation

#KT-11634 Fixed
This commit is contained in:
Michael Bogdanov
2016-07-19 16:53:01 +03:00
parent ae06f01c95
commit 6f41e3b462
6 changed files with 145 additions and 0 deletions
@@ -1274,6 +1274,18 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
}
}
}
@Override
public void visitSuperExpression(@NotNull KtSuperExpression expression) {
KotlinType thisTypeForSuperCall = bindingContext.get(BindingContext.THIS_TYPE_FOR_SUPER_EXPRESSION, expression);
assert thisTypeForSuperCall != null : "This type for superCall ''" + expression.getText() + "'' should be not null!";
ClassifierDescriptor descriptor = thisTypeForSuperCall.getConstructor().getDeclarationDescriptor();
assert descriptor instanceof ClassDescriptor :
"'This' reference target for ''" + expression.getText() + "''should be class descriptor, but was " + descriptor;
if (descriptor instanceof ClassDescriptor) {
lookupInContext(descriptor);
}
}
};
for (KtDeclaration declaration : myClass.getDeclarations()) {