Drop traits with required classes

#KT-4771 Rejected
This commit is contained in:
Alexander Udalov
2015-06-16 23:40:25 +03:00
parent dc909ba1d4
commit 1a3209e1dc
63 changed files with 49 additions and 1109 deletions
@@ -437,10 +437,15 @@ public abstract class StackValue {
return new CoercionValue(value, castType);
}
public static StackValue thisOrOuter(@NotNull ExpressionCodegen codegen, @NotNull ClassDescriptor descriptor, boolean isSuper, boolean isExplicit) {
// Coerce this/super for traits to support traits with required classes.
@NotNull
public static StackValue thisOrOuter(
@NotNull ExpressionCodegen codegen,
@NotNull ClassDescriptor descriptor,
boolean isSuper,
boolean isExplicit
) {
// Coerce explicit 'this' for the case when it is smart cast.
// Do not coerce for other classes due to the 'protected' access issues (JVMS 7, 4.9.2 Structural Constraints).
// Do not coerce for other cases due to the 'protected' access issues (JVMS 7, 4.9.2 Structural Constraints).
boolean coerceType = descriptor.getKind() == ClassKind.INTERFACE || (isExplicit && !isSuper);
return new ThisOuter(codegen, descriptor, isSuper, coerceType);
}