KT-3833 Invoke method not working inside class object?
#KT-3833 Fixed
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user