diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/lazy/ResolveSession.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/lazy/ResolveSession.java index eae2a3d1dac..5e4886f29fa 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/lazy/ResolveSession.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/lazy/ResolveSession.java @@ -217,6 +217,20 @@ public class ResolveSession { return getBindingContext().get(BindingContext.DECLARATION_TO_DESCRIPTOR, function); } + @Override + public DeclarationDescriptor visitParameter(JetParameter parameter, Void data) { + PsiElement grandFather = parameter.getParent().getParent(); + if (grandFather instanceof JetClass) { + JetClass jetClass = (JetClass) grandFather; + // This is a primary constructor parameter + if (parameter.getValOrVarNode() != null) { + getClassDescriptor(jetClass).getDefaultType().getMemberScope().getProperties(parameter.getNameAsName()); + return getBindingContext().get(BindingContext.PRIMARY_CONSTRUCTOR_PARAMETER, parameter); + } + } + return super.visitParameter(parameter, data); + } + @Override public DeclarationDescriptor visitProperty(JetProperty property, Void data) { JetScope scopeForDeclaration = getInjector().getScopeProvider().getResolutionScopeForDeclaration(property); @@ -226,7 +240,7 @@ public class ResolveSession { @Override public DeclarationDescriptor visitJetElement(JetElement element, Void data) { - throw new IllegalArgumentException("Unsupported declaration type: " + element); + throw new IllegalArgumentException("Unsupported declaration type: " + element + " " + element.getText()); } }, null); }