FIR: introduce diagnostic NESTED_CLASS_NOT_ALLOWED
This commit is contained in:
committed by
Mikhail Glukhikh
parent
c5cabce2d5
commit
724ca1d3ee
+1
-1
@@ -11,7 +11,7 @@ enum class C {
|
||||
O_O
|
||||
}
|
||||
|
||||
class G
|
||||
<!NESTED_CLASS_NOT_ALLOWED!>class G<!>
|
||||
},
|
||||
|
||||
E4 {
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ enum class C {
|
||||
O_O
|
||||
}
|
||||
|
||||
class G
|
||||
<!NESTED_CLASS_NOT_ALLOWED!>class G<!>
|
||||
},
|
||||
|
||||
E4 {
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
class A {
|
||||
inner class B {
|
||||
companion object { }
|
||||
companion <!NESTED_CLASS_NOT_ALLOWED!>object<!> { }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -1,10 +1,10 @@
|
||||
class A {
|
||||
inner class I {
|
||||
companion object A
|
||||
companion <!NESTED_CLASS_NOT_ALLOWED!>object A<!>
|
||||
|
||||
companion <!MANY_COMPANION_OBJECTS!>object B<!>
|
||||
companion <!MANY_COMPANION_OBJECTS, NESTED_CLASS_NOT_ALLOWED!>object B<!>
|
||||
|
||||
companion <!MANY_COMPANION_OBJECTS!>object C<!>
|
||||
companion <!MANY_COMPANION_OBJECTS, NESTED_CLASS_NOT_ALLOWED!>object C<!>
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
-16
@@ -1,16 +0,0 @@
|
||||
// !LANGUAGE: +NestedClassesInEnumEntryShouldBeInner
|
||||
|
||||
enum class E {
|
||||
FIRST,
|
||||
SECOND {
|
||||
class A
|
||||
};
|
||||
}
|
||||
|
||||
val foo: Any.() -> Unit = {}
|
||||
|
||||
fun f1() = E.FIRST.foo()
|
||||
fun f2() = E.FIRST.(foo)()
|
||||
fun f3() = E.SECOND.foo()
|
||||
fun f4() = E.SECOND.(foo)()
|
||||
fun f5() = E.SECOND.<!UNRESOLVED_REFERENCE!>A<!>()
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !LANGUAGE: +NestedClassesInEnumEntryShouldBeInner
|
||||
|
||||
enum class E {
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
enum class E {
|
||||
FIRST,
|
||||
SECOND {
|
||||
class A
|
||||
<!NESTED_CLASS_NOT_ALLOWED!>class A<!>
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
-7
@@ -1,7 +0,0 @@
|
||||
class A {
|
||||
inner class B {
|
||||
enum class E {
|
||||
ENTRY
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
class A {
|
||||
inner class B {
|
||||
<!NESTED_CLASS_NOT_ALLOWED!>enum class E<!> {
|
||||
|
||||
-9
@@ -1,9 +0,0 @@
|
||||
class A {
|
||||
companion object {
|
||||
enum class E { ENTRY } // OK
|
||||
}
|
||||
|
||||
inner class B {
|
||||
enum class E { ENTRY }
|
||||
}
|
||||
}
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
class A {
|
||||
companion object {
|
||||
enum class E { ENTRY } // OK
|
||||
|
||||
@@ -30,4 +30,4 @@ class Derived: Base() {
|
||||
inline final override fun foo(a: Int) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class Outer {
|
||||
inner class Inner {
|
||||
annotation class TestNestedAnnotation
|
||||
annotation <!NESTED_CLASS_NOT_ALLOWED!>class TestNestedAnnotation<!>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class Outer {
|
||||
inner class Inner {
|
||||
enum class TestNestedEnum
|
||||
<!NESTED_CLASS_NOT_ALLOWED!>enum class TestNestedEnum<!>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -4,9 +4,9 @@ enum class Enum {
|
||||
ENTRY_WITH_CLASS {
|
||||
inner class TestInner
|
||||
|
||||
class TestNested
|
||||
<!NESTED_CLASS_NOT_ALLOWED!>class TestNested<!>
|
||||
|
||||
interface TestInterface
|
||||
<!NESTED_CLASS_NOT_ALLOWED!>interface TestInterface<!>
|
||||
|
||||
object TestObject
|
||||
|
||||
|
||||
+2
-2
@@ -4,9 +4,9 @@ enum class Enum {
|
||||
ENTRY_WITH_CLASS {
|
||||
inner class TestInner
|
||||
|
||||
class TestNested
|
||||
<!NESTED_CLASS_NOT_ALLOWED!>class TestNested<!>
|
||||
|
||||
interface TestInterface
|
||||
<!NESTED_CLASS_NOT_ALLOWED!>interface TestInterface<!>
|
||||
|
||||
object TestObject
|
||||
|
||||
|
||||
+2
-2
@@ -4,9 +4,9 @@ enum class Enum {
|
||||
ENTRY_WITH_CLASS {
|
||||
inner class TestInner
|
||||
|
||||
class TestNested
|
||||
<!NESTED_CLASS_NOT_ALLOWED!>class TestNested<!>
|
||||
|
||||
interface TestInterface
|
||||
<!NESTED_CLASS_NOT_ALLOWED!>interface TestInterface<!>
|
||||
|
||||
object TestObject
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class Outer {
|
||||
inner class Inner {
|
||||
interface TestNestedInterface
|
||||
<!NESTED_CLASS_NOT_ALLOWED!>interface TestNestedInterface<!>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
// !LANGUAGE: +NestedClassesInEnumEntryShouldBeInner
|
||||
|
||||
class A {
|
||||
inner class B {
|
||||
class C
|
||||
}
|
||||
|
||||
fun foo() {
|
||||
class B {
|
||||
class C
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun foo() {
|
||||
class B {
|
||||
class C
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
enum class E {
|
||||
E1 {
|
||||
class D
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !LANGUAGE: +NestedClassesInEnumEntryShouldBeInner
|
||||
|
||||
class A {
|
||||
|
||||
+4
-4
@@ -2,25 +2,25 @@
|
||||
|
||||
class A {
|
||||
inner class B {
|
||||
class C
|
||||
<!NESTED_CLASS_NOT_ALLOWED!>class C<!>
|
||||
}
|
||||
|
||||
fun foo() {
|
||||
class B {
|
||||
class C
|
||||
<!NESTED_CLASS_NOT_ALLOWED!>class C<!>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun foo() {
|
||||
class B {
|
||||
class C
|
||||
<!NESTED_CLASS_NOT_ALLOWED!>class C<!>
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
enum class E {
|
||||
E1 {
|
||||
class D
|
||||
<!NESTED_CLASS_NOT_ALLOWED!>class D<!>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
// SKIP_TXT
|
||||
class Outer {
|
||||
inner class Inner1 {
|
||||
object Obj1
|
||||
<!NESTED_CLASS_NOT_ALLOWED!>object Obj1<!>
|
||||
|
||||
companion object Obj2
|
||||
companion <!NESTED_CLASS_NOT_ALLOWED!>object Obj2<!>
|
||||
|
||||
inner class Inner2 {
|
||||
object Obj3
|
||||
<!NESTED_CLASS_NOT_ALLOWED!>object Obj3<!>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -4,6 +4,6 @@ fun f() {
|
||||
<!LOCAL_ANNOTATION_CLASS_ERROR!>annotation class Anno<!>
|
||||
|
||||
@Anno class Local {
|
||||
<!LOCAL_ANNOTATION_CLASS_ERROR!>annotation class Nested<!>
|
||||
<!LOCAL_ANNOTATION_CLASS_ERROR!>annotation <!NESTED_CLASS_NOT_ALLOWED!>class Nested<!><!>
|
||||
}
|
||||
}
|
||||
|
||||
-9
@@ -1,9 +0,0 @@
|
||||
// !LANGUAGE: +ProhibitLocalAnnotations
|
||||
|
||||
fun f() {
|
||||
<!LOCAL_ANNOTATION_CLASS_ERROR!>annotation class Anno<!>
|
||||
|
||||
@Anno class Local {
|
||||
<!LOCAL_ANNOTATION_CLASS_ERROR!>annotation class Nested<!>
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !LANGUAGE: +ProhibitLocalAnnotations
|
||||
|
||||
fun f() {
|
||||
|
||||
@@ -6,9 +6,9 @@ fun foo() {
|
||||
<!LOCAL_INTERFACE_NOT_ALLOWED!>interface c<!> {}
|
||||
}
|
||||
class A {
|
||||
<!LOCAL_INTERFACE_NOT_ALLOWED!>interface d<!> {}
|
||||
<!LOCAL_INTERFACE_NOT_ALLOWED, NESTED_CLASS_NOT_ALLOWED!>interface d<!> {}
|
||||
}
|
||||
val f = {
|
||||
<!LOCAL_INTERFACE_NOT_ALLOWED!>interface e<!> {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ enum class MyEnum {
|
||||
|
||||
class Outer {
|
||||
inner class Inner {
|
||||
object C {
|
||||
<!NESTED_CLASS_NOT_ALLOWED!>object C<!> {
|
||||
const val a = 18
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user