KT-3257 Bad diagnostics when trying to instantiate a private class
#KT-3257 Fixed
This commit is contained in:
committed by
Nikolay Krasko
parent
d645fcaaa7
commit
4b656d8c8d
@@ -0,0 +1,15 @@
|
||||
package foo.bar
|
||||
|
||||
class A {
|
||||
private class B
|
||||
public class C private()
|
||||
|
||||
private fun bar() {}
|
||||
}
|
||||
|
||||
fun foo() {
|
||||
A.B() // ERROR 1: Cannot access 'B': it is 'private' in 'A'
|
||||
A.C() // ERROR 2: Cannot access '' : it is 'private' in 'C'
|
||||
|
||||
A().bar() // ERROR 3: Cannot access 'bar' : it is 'private' in 'A'
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
<!-- invisibleMember1 -->
|
||||
Cannot access 'B': it is 'private' in 'A'
|
||||
@@ -0,0 +1,2 @@
|
||||
<!-- invisibleMember2 -->
|
||||
Cannot access '<init>': it is 'private' in 'C'
|
||||
@@ -0,0 +1,2 @@
|
||||
<!-- invisibleMember3 -->
|
||||
Cannot access 'bar': it is 'private' in 'A'
|
||||
@@ -34,7 +34,6 @@ import org.jetbrains.jet.lang.resolve.java.AnalyzerFacadeForJVM;
|
||||
import org.jetbrains.jet.plugin.PluginTestCaseBase;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -110,4 +109,8 @@ public class DiagnosticMessageTest extends JetLiteFixture {
|
||||
public void testTypeMismatchWithNothing() throws Exception {
|
||||
doTest("typeMismatchWithNothing", 1, Errors.TYPE_MISMATCH);
|
||||
}
|
||||
|
||||
public void testInvisibleMember() throws Exception {
|
||||
doTest("invisibleMember", 3, Errors.INVISIBLE_MEMBER, Errors.INVISIBLE_MEMBER, Errors.INVISIBLE_MEMBER);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user