diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/FunctionCodegen.java b/compiler/backend/src/org/jetbrains/jet/codegen/FunctionCodegen.java index e4d7dc8ada6..16d4cd76a97 100644 --- a/compiler/backend/src/org/jetbrains/jet/codegen/FunctionCodegen.java +++ b/compiler/backend/src/org/jetbrains/jet/codegen/FunctionCodegen.java @@ -81,6 +81,10 @@ public class FunctionCodegen { JetDeclarationWithBody fun ) { + if (functionDescriptor.getKind() == CallableMemberDescriptor.Kind.FAKE_OVERRIDE) { + throw new IllegalStateException("must not generate code for fake overrides"); + } + List paramDescrs = functionDescriptor.getValueParameters(); List typeParameters = (functionDescriptor instanceof PropertyAccessorDescriptor ? ((PropertyAccessorDescriptor)functionDescriptor).getCorrespondingProperty(): functionDescriptor).getTypeParameters(); @@ -191,6 +195,10 @@ public class FunctionCodegen { frameMap.enter(parameter, argTypes[i+add].getSize()); } + if ((kind instanceof OwnerKind.DelegateKind) != (functionDescriptor.getKind() == FunctionDescriptor.Kind.DELEGATION)) { + throw new IllegalStateException("mismatching kind in " + functionDescriptor); + } + if (kind instanceof OwnerKind.DelegateKind) { OwnerKind.DelegateKind dk = (OwnerKind.DelegateKind) kind; InstructionAdapter iv = new InstructionAdapter(mv); diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/PropertyCodegen.java b/compiler/backend/src/org/jetbrains/jet/codegen/PropertyCodegen.java index d5321f9b329..7950140aa4f 100644 --- a/compiler/backend/src/org/jetbrains/jet/codegen/PropertyCodegen.java +++ b/compiler/backend/src/org/jetbrains/jet/codegen/PropertyCodegen.java @@ -147,6 +147,10 @@ public class PropertyCodegen { } public void generateDefaultGetter(PropertyDescriptor propertyDescriptor, int flags, PsiElement origin) { + if (propertyDescriptor.getKind() == CallableMemberDescriptor.Kind.FAKE_OVERRIDE) { + throw new IllegalStateException("must not generate code for fake overrides"); + } + if (kind == OwnerKind.TRAIT_IMPL) { return; } @@ -186,6 +190,11 @@ public class PropertyCodegen { iv.load(0, JetTypeMapper.TYPE_OBJECT); } final Type type = state.getInjector().getJetTypeMapper().mapType(propertyDescriptor.getType()); + + if ((kind instanceof OwnerKind.DelegateKind) != (propertyDescriptor.getKind() == FunctionDescriptor.Kind.DELEGATION)) { + throw new IllegalStateException("mismatching kind in " + propertyDescriptor); + } + if (kind instanceof OwnerKind.DelegateKind) { OwnerKind.DelegateKind dk = (OwnerKind.DelegateKind) kind; dk.getDelegate().put(JetTypeMapper.TYPE_OBJECT, iv); @@ -222,6 +231,10 @@ public class PropertyCodegen { } public void generateDefaultSetter(PropertyDescriptor propertyDescriptor, int flags, PsiElement origin) { + if (propertyDescriptor.getKind() == CallableMemberDescriptor.Kind.FAKE_OVERRIDE) { + throw new IllegalStateException("must not generate code for fake overrides"); + } + if (kind == OwnerKind.TRAIT_IMPL) { return; } @@ -263,6 +276,10 @@ public class PropertyCodegen { paramCode = 1; } + if ((kind instanceof OwnerKind.DelegateKind) != (propertyDescriptor.getKind() == FunctionDescriptor.Kind.DELEGATION)) { + throw new IllegalStateException("mismatching kind in " + propertyDescriptor); + } + if (kind instanceof OwnerKind.DelegateKind) { OwnerKind.DelegateKind dk = (OwnerKind.DelegateKind) kind; iv.load(0, JetTypeMapper.TYPE_OBJECT);