EA-39104 - IAE: DescriptorResolver.getPropertyDeclarationInnerScope

Fixed
This commit is contained in:
Andrey Breslav
2012-11-06 12:59:37 +04:00
parent cb0bf3c263
commit 14e5b777c4
3 changed files with 26 additions and 3 deletions
@@ -170,11 +170,20 @@ public class ResolveSessionUtils {
bodyResolver.resolvePropertyInitializer(jetProperty, descriptor, propertyInitializer, propertyResolutionScope);
}
addAccessorDeclaringScopes(jetProperty, bodyResolveContext, propertyResolutionScope);
bodyResolver.resolvePropertyAccessors(jetProperty, descriptor);
}
private static void addAccessorDeclaringScopes(
JetProperty jetProperty,
EmptyBodyResolveContext bodyResolveContext,
JetScope propertyResolutionScope
) {
ImmutableMap.Builder<JetDeclaration, JetScope> builder = ImmutableMap.builder();
for (final JetPropertyAccessor propertyAccessor : jetProperty.getAccessors()) {
bodyResolveContext.setDeclaringScopes(
ImmutableMap.<JetDeclaration, JetScope>builder().put(propertyAccessor, propertyResolutionScope).build());
bodyResolver.resolvePropertyAccessors(jetProperty, descriptor);
builder.put(propertyAccessor, propertyResolutionScope);
}
bodyResolveContext.setDeclaringScopes(builder.build());
}
private static void functionAdditionalResolve(
@@ -0,0 +1,10 @@
val a: Int = 1
get() {
return $a
}
set(v) {
$a = <caret>
}
// EXIST: a
@@ -244,6 +244,10 @@ public class JetBasicCompletionTest extends JetCompletionTestBase {
doTest();
}
public void testCompletionInSetter() {
doTest();
}
@Override
protected String getTestDataPath() {
return new File(PluginTestCaseBase.getTestDataPathBase(), "/completion/basic").getPath() +