KT-3833 Invoke method not working inside class object?

#KT-3833 Fixed
This commit is contained in:
Svetlana Isakova
2013-09-11 16:26:20 +04:00
parent d50f65634a
commit 5f189a8c0f
3 changed files with 41 additions and 1 deletions
@@ -185,7 +185,7 @@ public class CandidateResolver {
private static boolean checkOuterClassMemberIsAccessible(@NotNull CallCandidateResolutionContext<?> context) {
// In "this@Outer.foo()" the error will be reported on "this@Outer" instead
if (context.call.getExplicitReceiver().exists()) return true;
if (context.call.getExplicitReceiver().exists() || context.call.getThisObject().exists()) return true;
ClassDescriptor candidateThis = getDeclaringClass(context.candidateCall.getCandidateDescriptor());
if (candidateThis == null || candidateThis.getKind().isObject()) return true;
@@ -0,0 +1,35 @@
//KT-3833 Invoke method not working inside class object?
package m
class Either1 {
class Left() {
fun match(left: () -> Unit) {
left()
}
}
inner class Right() {
fun match(right: () -> Unit) {
right()
}
}
}
class X {
fun invoke() {
}
}
object Foo{
val v : X = X()
}
class C{
class object {
fun f(){
Foo.v()
}
}
}
@@ -4975,6 +4975,11 @@ public class JetDiagnosticsTestGenerated extends AbstractDiagnosticsTestWithEage
doTest("compiler/testData/diagnostics/tests/resolve/invoke/kt3772.kt");
}
@TestMetadata("kt3833-invokeInsideNestedClass.kt")
public void testKt3833_invokeInsideNestedClass() throws Exception {
doTest("compiler/testData/diagnostics/tests/resolve/invoke/kt3833-invokeInsideNestedClass.kt");
}
}
@TestMetadata("compiler/testData/diagnostics/tests/resolve/nestedCalls")