[FIR] Add diagnostics for object related problems

This commit is contained in:
Nick
2020-07-30 17:11:15 +03:00
committed by Mikhail Glukhikh
parent 694d3cad4e
commit 26e3a111d6
32 changed files with 419 additions and 77 deletions
@@ -0,0 +1,31 @@
object A {
object B {
object C
}
interface X
val a = object : Any() {
<!LOCAL_OBJECT_NOT_ALLOWED!>object D<!> {
<!LOCAL_OBJECT_NOT_ALLOWED!>object G<!>
<!LOCAL_INTERFACE_NOT_ALLOWED!>interface Z<!>
}
<!LOCAL_INTERFACE_NOT_ALLOWED!>interface Y<!>
}
fun b() {
<!LOCAL_OBJECT_NOT_ALLOWED!>object E<!> {
<!LOCAL_OBJECT_NOT_ALLOWED!>object F<!>
<!LOCAL_INTERFACE_NOT_ALLOWED!>interface M<!>
}
<!LOCAL_INTERFACE_NOT_ALLOWED!>interface N<!>
val c = object : Any() {
val t = "test"
<!LOCAL_INTERFACE_NOT_ALLOWED!>interface U<!>
}
}
}
@@ -0,0 +1,89 @@
FILE: localEntitytNotAllowed.kt
public final object A : R|kotlin/Any| {
private constructor(): R|A| {
super<R|kotlin/Any|>()
}
public final object B : R|kotlin/Any| {
private constructor(): R|A.B| {
super<R|kotlin/Any|>()
}
public final object C : R|kotlin/Any| {
private constructor(): R|A.B.C| {
super<R|kotlin/Any|>()
}
}
}
public abstract interface X : R|kotlin/Any| {
}
public final val a: R|<anonymous>| = object : R|kotlin/Any| {
private constructor(): R|<anonymous>| {
super<R|kotlin/Any|>()
}
local final object D : R|kotlin/Any| {
private constructor(): R|A.<anonymous>.D| {
super<R|kotlin/Any|>()
}
local final object G : R|kotlin/Any| {
private constructor(): R|A.<anonymous>.D.G| {
super<R|kotlin/Any|>()
}
}
local abstract interface Z : R|kotlin/Any| {
}
}
local abstract interface Y : R|kotlin/Any| {
}
}
public get(): R|<anonymous>|
public final fun b(): R|kotlin/Unit| {
local final object E : R|kotlin/Any| {
private constructor(): R|A.E| {
super<R|kotlin/Any|>()
}
local final object F : R|kotlin/Any| {
private constructor(): R|A.E.F| {
super<R|kotlin/Any|>()
}
}
local abstract interface M : R|kotlin/Any| {
}
}
local abstract interface N : R|kotlin/Any| {
}
lval c: R|<anonymous>| = object : R|kotlin/Any| {
private constructor(): R|<anonymous>| {
super<R|kotlin/Any|>()
}
public final val t: R|kotlin/String| = String(test)
public get(): R|kotlin/String|
local abstract interface U : R|kotlin/Any| {
}
}
}
}
@@ -0,0 +1,19 @@
class A {
companion object {
}
companion <!MANY_COMPANION_OBJECTS!>object<!> {
}
}
class B {
companion object A {
}
companion <!MANY_COMPANION_OBJECTS!>object B<!> {
}
}
@@ -0,0 +1,41 @@
FILE: manyCompanionObjects.kt
public final class A : R|kotlin/Any| {
public constructor(): R|A| {
super<R|kotlin/Any|>()
}
public final companion object Companion : R|kotlin/Any| {
private constructor(): R|A.Companion| {
super<R|kotlin/Any|>()
}
}
public final companion object Companion : R|kotlin/Any| {
private constructor(): R|A.Companion| {
super<R|kotlin/Any|>()
}
}
}
public final class B : R|kotlin/Any| {
public constructor(): R|B| {
super<R|kotlin/Any|>()
}
public final companion object A : R|kotlin/Any| {
private constructor(): R|B.A| {
super<R|kotlin/Any|>()
}
}
public final companion object B : R|kotlin/Any| {
private constructor(): R|B.B| {
super<R|kotlin/Any|>()
}
}
}
@@ -0,0 +1,15 @@
<!TYPE_PARAMETERS_IN_OBJECT!>object A<!><T, K : T> {
<!TYPE_PARAMETERS_IN_OBJECT!>object B<!><L>
}
class N {
companion <!TYPE_PARAMETERS_IN_OBJECT!>object<!><T> {
}
}
fun test() {
<!LOCAL_OBJECT_NOT_ALLOWED, TYPE_PARAMETERS_IN_OBJECT!>object M<!><H> {
}
}
@@ -0,0 +1,36 @@
FILE: typeParametersInObject.kt
public final object A<T, K : R|T|> : R|kotlin/Any| {
private constructor<T, K : R|T|>(): R|A<T, K>| {
super<R|kotlin/Any|>()
}
public final object B<L> : R|kotlin/Any| {
private constructor<L>(): R|A.B<L>| {
super<R|kotlin/Any|>()
}
}
}
public final class N : R|kotlin/Any| {
public constructor(): R|N| {
super<R|kotlin/Any|>()
}
public final companion object Companion<T> : R|kotlin/Any| {
private constructor<T>(): R|N.Companion<T>| {
super<R|kotlin/Any|>()
}
}
}
public final fun test(): R|kotlin/Unit| {
local final object M<H> : R|kotlin/Any| {
private constructor<H>(): R|M<H>| {
super<R|kotlin/Any|>()
}
}
}