DataFlowInfo taken into account when resolving component functions

This commit is contained in:
Andrey Breslav
2012-08-17 20:39:56 +04:00
parent b44c6f2d6e
commit 2dc6691c1a
3 changed files with 20 additions and 1 deletions
@@ -253,7 +253,7 @@ public class ExpressionTypingUtils {
@NotNull Name name
) {
JetReferenceExpression fake = JetPsiFactory.createSimpleName(context.expressionTypingServices.getProject(), "fake");
BindingTrace fakeTrace = new BindingTraceContext();
BindingTrace fakeTrace = TemporaryBindingTrace.create(context.trace);
Call call = CallMaker.makeCall(fake, receiver, null, fake, Collections.<ValueArgument>emptyList());
return context.replaceBindingTrace(fakeTrace).resolveCallWithGivenName(call, fake, name);
}
@@ -0,0 +1,14 @@
class A {
fun component1() : Int = 1
fun component2() : Int = 2
}
fun a(aa : A?, b : Any) {
if (aa != null) {
val (a1, b1) = aa;
}
if (b is A) {
val (a1, b1) = b;
}
}
@@ -1053,6 +1053,11 @@ public class JetDiagnosticsTestGenerated extends AbstractDiagnosticsTestWithEage
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.checkers.AbstractDiagnosticsTestWithEagerResolve", new File("compiler/testData/diagnostics/tests/declarationChecks"), "kt", false);
}
@TestMetadata("DataFlowInfoInMultiDecl.kt")
public void testDataFlowInfoInMultiDecl() throws Exception {
doTest("compiler/testData/diagnostics/tests/declarationChecks/DataFlowInfoInMultiDecl.kt");
}
@TestMetadata("kt1141.kt")
public void testKt1141() throws Exception {
doTest("compiler/testData/diagnostics/tests/declarationChecks/kt1141.kt");