FirSupertypesChecker: implement six more diagnostics

This commit is contained in:
Mikhail Glukhikh
2021-05-06 13:57:08 +03:00
parent db828a6aad
commit 0f9f63400e
73 changed files with 337 additions and 230 deletions
@@ -1,5 +1,5 @@
FILE: classInSupertypeForEnum.kt FILE: classInSupertypeForEnum.kt
public final class A : R|kotlin/Any| { public open class A : R|kotlin/Any| {
public constructor(): R|A| { public constructor(): R|A| {
super<R|kotlin/Any|>() super<R|kotlin/Any|>()
} }
@@ -1,5 +1,5 @@
class A open class A
interface C interface C
enum class B : C, <!CLASS_IN_SUPERTYPE_FOR_ENUM!>A<!>(), Any() enum class B : C, <!CLASS_IN_SUPERTYPE_FOR_ENUM!>A<!>(), <!MANY_CLASSES_IN_SUPERTYPE_LIST!>Any<!>()
@@ -1,3 +1,5 @@
// FIR_IDE_IGNORE
<!CONFLICTING_OVERLOADS!>fun test(x: Int)<!> {} <!CONFLICTING_OVERLOADS!>fun test(x: Int)<!> {}
<!CONFLICTING_OVERLOADS!>fun test(y: Int)<!> {} <!CONFLICTING_OVERLOADS!>fun test(y: Int)<!> {}
@@ -16,7 +18,7 @@ fun test(z: Int, c: Char) {}
}<!> }<!>
<!REDECLARATION!>class B : <!SUPERTYPE_NOT_INITIALIZED!>A<!> { <!REDECLARATION!>class B : <!FINAL_SUPERTYPE, SUPERTYPE_NOT_INITIALIZED!>A<!> {
<!CONFLICTING_OVERLOADS!>override fun rest(s: String)<!> {} <!CONFLICTING_OVERLOADS!>override fun rest(s: String)<!> {}
<!CONFLICTING_OVERLOADS!>fun rest(s: String)<!> {} <!CONFLICTING_OVERLOADS!>fun rest(s: String)<!> {}
@@ -125,7 +125,7 @@ FILE: cyclicConstructorDelegationCall.kt
} }
} }
public final class M : R|kotlin/Any| { public open class M : R|kotlin/Any| {
public constructor(m: R|kotlin/Int|): R|M| { public constructor(m: R|kotlin/Int|): R|M| {
super<R|kotlin/Any|>() super<R|kotlin/Any|>()
} }
@@ -58,7 +58,7 @@ class K(x: Int) {
constructor() : <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>() {} constructor() : <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>() {}
} }
class M { open class M {
constructor(m: Int) constructor(m: Int)
} }
@@ -1,5 +1,5 @@
FILE: delegationInInterface.kt FILE: delegationInInterface.kt
public final class A : R|kotlin/Any| { public open class A : R|kotlin/Any| {
public constructor(): R|A| { public constructor(): R|A| {
super<R|kotlin/Any|>() super<R|kotlin/Any|>()
} }
@@ -1,4 +1,4 @@
class A open class A
interface B : <!DELEGATION_IN_INTERFACE, INTERFACE_WITH_SUPERCLASS!>A<!> by <!UNRESOLVED_REFERENCE!>a<!> { interface B : <!DELEGATION_IN_INTERFACE, INTERFACE_WITH_SUPERCLASS!>A<!> by <!UNRESOLVED_REFERENCE!>a<!> {
val a: A val a: A
@@ -1,5 +1,5 @@
FILE: explicitDelegationCallRequired.kt FILE: explicitDelegationCallRequired.kt
public final class A : R|kotlin/Any| { public open class A : R|kotlin/Any| {
public constructor(x: R|kotlin/Int|): R|A| { public constructor(x: R|kotlin/Int|): R|A| {
super<R|kotlin/Any|>() super<R|kotlin/Any|>()
} }
@@ -1,4 +1,4 @@
class A(x: Int) { open class A(x: Int) {
constructor(z: String) : this(10) constructor(z: String) : this(10)
} }
@@ -1,5 +1,5 @@
FILE: interfaceWithSuperclass.kt FILE: interfaceWithSuperclass.kt
public final class A : R|kotlin/Any| { public open class A : R|kotlin/Any| {
public constructor(): R|A| { public constructor(): R|A| {
super<R|kotlin/Any|>() super<R|kotlin/Any|>()
} }
@@ -9,7 +9,7 @@ FILE: interfaceWithSuperclass.kt
} }
public abstract interface C : R|kotlin/Any| { public abstract interface C : R|kotlin/Any| {
} }
public final class D : R|kotlin/Any| { public open class D : R|kotlin/Any| {
public constructor(): R|D| { public constructor(): R|D| {
super<R|kotlin/Any|>() super<R|kotlin/Any|>()
} }
@@ -1,8 +1,8 @@
class A open class A
interface B : <!INTERFACE_WITH_SUPERCLASS, SUPERTYPE_INITIALIZED_IN_INTERFACE!>A<!>() interface B : <!INTERFACE_WITH_SUPERCLASS, SUPERTYPE_INITIALIZED_IN_INTERFACE!>A<!>()
interface C interface C
class D open class D
interface E : <!INTERFACE_WITH_SUPERCLASS, SUPERTYPE_INITIALIZED_IN_INTERFACE!>A<!>(), C, <!SUPERTYPE_INITIALIZED_IN_INTERFACE!>D<!>() interface E : <!INTERFACE_WITH_SUPERCLASS, SUPERTYPE_INITIALIZED_IN_INTERFACE!>A<!>(), C, <!MANY_CLASSES_IN_SUPERTYPE_LIST, SUPERTYPE_INITIALIZED_IN_INTERFACE!>D<!>()
@@ -1,5 +1,5 @@
FILE: notASupertype.kt FILE: notASupertype.kt
public final class A : R|kotlin/Any| { public open class A : R|kotlin/Any| {
public constructor(): R|A| { public constructor(): R|A| {
super<R|kotlin/Any|>() super<R|kotlin/Any|>()
} }
@@ -1,4 +1,4 @@
class A { open class A {
fun f() {} fun f() {}
} }
@@ -1,3 +1,5 @@
// FIR_IDE_IGNORE
sealed class A sealed class A
<!REDECLARATION!>class B : A()<!> <!REDECLARATION!>class B : A()<!>
@@ -6,7 +8,7 @@ interface C : <!INTERFACE_WITH_SUPERCLASS!>A<!>
interface D : C, <!INTERFACE_WITH_SUPERCLASS!>A<!> interface D : C, <!INTERFACE_WITH_SUPERCLASS!>A<!>
class E : B, A() class E : <!SINGLETON_IN_SUPERTYPE!>B<!>, <!MANY_CLASSES_IN_SUPERTYPE_LIST!>A<!>()
sealed class P { sealed class P {
object H: P() object H: P()
@@ -1,5 +1,5 @@
FILE: superIsNotAnExpression.kt FILE: superIsNotAnExpression.kt
public final class A : R|kotlin/Any| { public open class A : R|kotlin/Any| {
public constructor(): R|A| { public constructor(): R|A| {
super<R|kotlin/Any|>() super<R|kotlin/Any|>()
} }
@@ -1,4 +1,4 @@
class A open class A
class B: A() { class B: A() {
fun act() { fun act() {
@@ -3,7 +3,7 @@ FILE: supertypeInitializedInInterface.kt
} }
public abstract interface B : R|A| { public abstract interface B : R|A| {
} }
public final class C : R|kotlin/Any| { public open class C : R|kotlin/Any| {
public constructor(): R|C| { public constructor(): R|C| {
super<R|kotlin/Any|>() super<R|kotlin/Any|>()
} }
@@ -2,12 +2,12 @@ interface A
interface B : <!SUPERTYPE_INITIALIZED_IN_INTERFACE!>A<!>() interface B : <!SUPERTYPE_INITIALIZED_IN_INTERFACE!>A<!>()
class C open class C
interface D : <!INTERFACE_WITH_SUPERCLASS, SUPERTYPE_INITIALIZED_IN_INTERFACE!>C<!>() interface D : <!INTERFACE_WITH_SUPERCLASS, SUPERTYPE_INITIALIZED_IN_INTERFACE!>C<!>()
interface E : <!INTERFACE_WITH_SUPERCLASS, SUPERTYPE_INITIALIZED_IN_INTERFACE!>Any<!>() interface E : <!INTERFACE_WITH_SUPERCLASS, SUPERTYPE_INITIALIZED_IN_INTERFACE!>Any<!>()
interface F : A, <!SUPERTYPE_INITIALIZED_IN_INTERFACE!>B<!>(), <!INTERFACE_WITH_SUPERCLASS!>C<!>, <!SUPERTYPE_INITIALIZED_IN_INTERFACE!>D<!>(), <!SUPERTYPE_INITIALIZED_IN_INTERFACE!>Any<!>() { interface F : A, <!SUPERTYPE_INITIALIZED_IN_INTERFACE!>B<!>(), <!INTERFACE_WITH_SUPERCLASS!>C<!>, <!SUPERTYPE_INITIALIZED_IN_INTERFACE!>D<!>(), <!MANY_CLASSES_IN_SUPERTYPE_LIST, SUPERTYPE_INITIALIZED_IN_INTERFACE!>Any<!>() {
} }
@@ -1,5 +1,5 @@
FILE: supertypeInitializedWithoutPrimaryConstructor.kt FILE: supertypeInitializedWithoutPrimaryConstructor.kt
public final class A : R|kotlin/Any| { public open class A : R|kotlin/Any| {
public constructor(): R|A| { public constructor(): R|A| {
super<R|kotlin/Any|>() super<R|kotlin/Any|>()
} }
@@ -11,7 +11,7 @@ FILE: supertypeInitializedWithoutPrimaryConstructor.kt
} }
} }
public final class C : R|kotlin/Any| { public open class C : R|kotlin/Any| {
public constructor(x: R|kotlin/Int|): R|C| { public constructor(x: R|kotlin/Int|): R|C| {
super<R|kotlin/Any|>() super<R|kotlin/Any|>()
} }
@@ -1,7 +1,7 @@
class A open class A
class B : <!SUPERTYPE_NOT_INITIALIZED!>A<!> class B : <!SUPERTYPE_NOT_INITIALIZED!>A<!>
class C(x: Int) open class C(x: Int)
<!NO_VALUE_FOR_PARAMETER!>class D : <!SUPERTYPE_NOT_INITIALIZED!>C<!><!> <!NO_VALUE_FOR_PARAMETER!>class D : <!SUPERTYPE_NOT_INITIALIZED!>C<!><!>
class E : C(10) class E : C(10)
class F() : C(10) class F() : C(10)
@@ -1,17 +1,17 @@
FILE: fakeRecursiveSupertype.kt FILE: fakeRecursiveSupertype.kt
public final class My : <ERROR TYPE REF: Loop in supertype: /My -> /My> { public open class My : <ERROR TYPE REF: Loop in supertype: /My -> /My> {
public constructor(): R|My| { public constructor(): R|My| {
super<R|My|>() super<R|My|>()
} }
} }
public final class Your : R|His| { public open class Your : R|His| {
public constructor(): R|Your| { public constructor(): R|Your| {
super<R|His|>() super<R|His|>()
} }
} }
public final class His : <ERROR TYPE REF: Loop in supertype: /His -> /Your> { public open class His : <ERROR TYPE REF: Loop in supertype: /His -> /Your> {
public constructor(): R|His| { public constructor(): R|His| {
super<R|Your|>() super<R|Your|>()
} }
@@ -1,7 +1,7 @@
import incorrect.directory.My import incorrect.directory.My
class My : <!OTHER_ERROR!>My<!>() open class My : <!OTHER_ERROR!>My<!>()
class Your : His() open class Your : His()
class His : <!OTHER_ERROR!>Your<!>() open class His : <!OTHER_ERROR!>Your<!>()
@@ -1,5 +1,5 @@
FILE: supertypeGenericsComplex.kt FILE: supertypeGenericsComplex.kt
public final class Out<out T> : R|kotlin/Any| { public open class Out<out T> : R|kotlin/Any| {
public constructor<out T>(): R|Out<T>| { public constructor<out T>(): R|Out<T>| {
super<R|kotlin/Any|>() super<R|kotlin/Any|>()
} }
@@ -1,4 +1,4 @@
class Out<out T> open class Out<out T>
interface X : <!INTERFACE_WITH_SUPERCLASS!>Out<String><!> interface X : <!INTERFACE_WITH_SUPERCLASS!>Out<String><!>
@@ -7,12 +7,12 @@ FILE: Test.kt
} }
public final fun listOf(): R|kotlin/collections/List<kotlin/String>| { public final fun listOf(): R|kotlin/collections/List<kotlin/String>| {
} }
public final class LightMember<D> : R|Member<D>|, R|Light| { public open class LightMember<D> : R|Member<D>|, R|Light| {
public constructor<D>(): R|LightMember<D>| { public constructor<D>(): R|LightMember<D>| {
super<R|Light|>() super<R|Light|>()
} }
public final override fun getName(): R|kotlin/String| { public open override fun getName(): R|kotlin/String| {
^getName String(Light) ^getName String(Light)
} }
@@ -35,7 +35,7 @@ fun List<Int>.single(): Int = 2
fun listOf(): List<String> {} fun listOf(): List<String> {}
public class LightMember<D> : Member<D>, Light() { public open class LightMember<D> : Member<D>, Light() {
override fun getName(): String = "Light" override fun getName(): String = "Light"
} }
@@ -28,7 +28,7 @@ private class C {
} }
} }
class D : <!SUPERTYPE_NOT_INITIALIZED!>A<!> { class D : <!FINAL_SUPERTYPE, SUPERTYPE_NOT_INITIALIZED!>A<!> {
class Test1 : A.AProtectedI { class Test1 : A.AProtectedI {
} }
@@ -38,11 +38,11 @@ interface E {
} }
class Test2 : A.APublicI, <!UNRESOLVED_REFERENCE!>B.BInner<!>() { class Test2 : A.APublicI, <!FINAL_SUPERTYPE, UNRESOLVED_REFERENCE!>B.BInner<!>() {
} }
class Test3 : C.CPublicI, <!EXPOSED_SUPER_CLASS, SUPERTYPE_NOT_INITIALIZED!>C<!> { class Test3 : C.CPublicI, <!EXPOSED_SUPER_CLASS, FINAL_SUPERTYPE, SUPERTYPE_NOT_INITIALIZED!>C<!> {
} }
@@ -50,11 +50,11 @@ class Test4 : E, A.AProtectedI {
} }
class Test5 : C.CPublicI, <!UNRESOLVED_REFERENCE!>B.BInner<!>() { class Test5 : C.CPublicI, <!FINAL_SUPERTYPE, UNRESOLVED_REFERENCE!>B.BInner<!>() {
} }
class Test6 : E, <!EXPOSED_SUPER_CLASS, SUPERTYPE_NOT_INITIALIZED!>C.CPublic<!> { class Test6 : E, <!EXPOSED_SUPER_CLASS, FINAL_SUPERTYPE, SUPERTYPE_NOT_INITIALIZED!>C.CPublic<!> {
} }
@@ -19,7 +19,7 @@ FILE: common.kt
} }
Module: m1-jvm Module: m1-jvm
FILE: jvm.kt FILE: jvm.kt
public final actual class MyList : R|kotlin/Any| { public open actual class MyList : R|kotlin/Any| {
public constructor(): R|MyList| { public constructor(): R|MyList| {
super<R|kotlin/Any|>() super<R|kotlin/Any|>()
} }
@@ -11,7 +11,7 @@ open class Wrapper(val list: MyList)
// MODULE: m1-jvm(m1-common) // MODULE: m1-jvm(m1-common)
// FILE: jvm.kt // FILE: jvm.kt
actual class MyList { actual open class MyList {
actual fun get(i: Int): Int = i actual fun get(i: Int): Int = i
fun set(i: Int, v: Int) {} fun set(i: Int, v: Int) {}
@@ -38,7 +38,7 @@ FILE: problems.kt
public get(): R|kotlin/String| public get(): R|kotlin/String|
public final val p: R|kotlin/Pair<kotlin/Int, kotlin/String>| = R|kotlin/Pair.Pair|<R|kotlin/Int|, R|kotlin/String|>(Int(0), String()) public final val p: R|kotlin/Pair<kotlin/Int, kotlin/String>| = R|kotlin/Pair.Pair|<R|kotlin/Int|, R|kotlin/String|>(Int(0), String())
public get(): R|kotlin/Pair<kotlin/Int, kotlin/String>| public get(): R|kotlin/Pair<kotlin/Int, kotlin/String>|
public final class Base<T> : R|kotlin/Any| { public open class Base<T> : R|kotlin/Any| {
public constructor<T>(x: R|T|): R|Base<T>| { public constructor<T>(x: R|T|): R|Base<T>| {
super<R|kotlin/Any|>() super<R|kotlin/Any|>()
} }
@@ -17,7 +17,7 @@ val String.bar get() = "987"
val p = Pair(0, "") val p = Pair(0, "")
class Base<T>(val x: T) open class Base<T>(val x: T)
class Derived : Base<Int>(10) class Derived : Base<Int>(10)
val xx = Derived().x + 1 val xx = Derived().x + 1
@@ -69,6 +69,7 @@ enum class PositioningStrategy(private val strategy: String? = null) {
SUSPEND_MODIFIER, SUSPEND_MODIFIER,
FUN_INTERFACE, FUN_INTERFACE,
RESERVED_UNDERSCORE, RESERVED_UNDERSCORE,
QUESTION_MARK_BY_TYPE,
; ;
@@ -100,17 +100,24 @@ object DIAGNOSTICS_LIST : DiagnosticList() {
val RECURSION_IN_SUPERTYPES by error<PsiElement>() val RECURSION_IN_SUPERTYPES by error<PsiElement>()
val NOT_A_SUPERTYPE by error<PsiElement>() val NOT_A_SUPERTYPE by error<PsiElement>()
val SUPERCLASS_NOT_ACCESSIBLE_FROM_INTERFACE by error<PsiElement>() val SUPERCLASS_NOT_ACCESSIBLE_FROM_INTERFACE by error<PsiElement>()
val QUALIFIED_SUPERTYPE_EXTENDED_BY_OTHER_SUPERTYPE by error<PsiElement> { val QUALIFIED_SUPERTYPE_EXTENDED_BY_OTHER_SUPERTYPE by error<KtTypeReference> {
parameter<FirClass<*>>("otherSuperType") parameter<FirClass<*>>("otherSuperType")
} }
val SUPERTYPE_INITIALIZED_IN_INTERFACE by error<PsiElement>() val SUPERTYPE_INITIALIZED_IN_INTERFACE by error<KtTypeReference>()
val INTERFACE_WITH_SUPERCLASS by error<PsiElement>() val INTERFACE_WITH_SUPERCLASS by error<KtTypeReference>()
val CLASS_IN_SUPERTYPE_FOR_ENUM by error<PsiElement>() val FINAL_SUPERTYPE by error<KtTypeReference>()
val SEALED_SUPERTYPE by error<PsiElement>() val SUPERTYPE_IS_EXTENSION_FUNCTION_TYPE by error<KtTypeReference>()
val SEALED_SUPERTYPE_IN_LOCAL_CLASS by error<PsiElement>() val SINGLETON_IN_SUPERTYPE by error<KtTypeReference>()
val NULLABLE_SUPERTYPE by error<KtTypeReference>(PositioningStrategy.QUESTION_MARK_BY_TYPE)
val MANY_CLASSES_IN_SUPERTYPE_LIST by error<KtTypeReference>()
val SUPERTYPE_APPEARS_TWICE by error<KtTypeReference>()
val CLASS_IN_SUPERTYPE_FOR_ENUM by error<KtTypeReference>()
val SEALED_SUPERTYPE by error<KtTypeReference>()
val SEALED_SUPERTYPE_IN_LOCAL_CLASS by error<KtTypeReference>()
val SUPERTYPE_NOT_A_CLASS_OR_INTERFACE by error<KtElement> { val SUPERTYPE_NOT_A_CLASS_OR_INTERFACE by error<KtElement> {
parameter<String>("reason") parameter<String>("reason")
} }
} }
val CONSTRUCTOR_PROBLEMS by object : DiagnosticGroup("Constructor problems") { val CONSTRUCTOR_PROBLEMS by object : DiagnosticGroup("Constructor problems") {
@@ -120,12 +120,18 @@ object FirErrors {
val RECURSION_IN_SUPERTYPES by error0<PsiElement>() val RECURSION_IN_SUPERTYPES by error0<PsiElement>()
val NOT_A_SUPERTYPE by error0<PsiElement>() val NOT_A_SUPERTYPE by error0<PsiElement>()
val SUPERCLASS_NOT_ACCESSIBLE_FROM_INTERFACE by error0<PsiElement>() val SUPERCLASS_NOT_ACCESSIBLE_FROM_INTERFACE by error0<PsiElement>()
val QUALIFIED_SUPERTYPE_EXTENDED_BY_OTHER_SUPERTYPE by error1<PsiElement, FirClass<*>>() val QUALIFIED_SUPERTYPE_EXTENDED_BY_OTHER_SUPERTYPE by error1<KtTypeReference, FirClass<*>>()
val SUPERTYPE_INITIALIZED_IN_INTERFACE by error0<PsiElement>() val SUPERTYPE_INITIALIZED_IN_INTERFACE by error0<KtTypeReference>()
val INTERFACE_WITH_SUPERCLASS by error0<PsiElement>() val INTERFACE_WITH_SUPERCLASS by error0<KtTypeReference>()
val CLASS_IN_SUPERTYPE_FOR_ENUM by error0<PsiElement>() val FINAL_SUPERTYPE by error0<KtTypeReference>()
val SEALED_SUPERTYPE by error0<PsiElement>() val SUPERTYPE_IS_EXTENSION_FUNCTION_TYPE by error0<KtTypeReference>()
val SEALED_SUPERTYPE_IN_LOCAL_CLASS by error0<PsiElement>() val SINGLETON_IN_SUPERTYPE by error0<KtTypeReference>()
val NULLABLE_SUPERTYPE by error0<KtTypeReference>(SourceElementPositioningStrategies.QUESTION_MARK_BY_TYPE)
val MANY_CLASSES_IN_SUPERTYPE_LIST by error0<KtTypeReference>()
val SUPERTYPE_APPEARS_TWICE by error0<KtTypeReference>()
val CLASS_IN_SUPERTYPE_FOR_ENUM by error0<KtTypeReference>()
val SEALED_SUPERTYPE by error0<KtTypeReference>()
val SEALED_SUPERTYPE_IN_LOCAL_CLASS by error0<KtTypeReference>()
val SUPERTYPE_NOT_A_CLASS_OR_INTERFACE by error1<KtElement, String>() val SUPERTYPE_NOT_A_CLASS_OR_INTERFACE by error1<KtElement, String>()
// Constructor problems // Constructor problems
@@ -6,26 +6,72 @@
package org.jetbrains.kotlin.fir.analysis.checkers.declaration package org.jetbrains.kotlin.fir.analysis.checkers.declaration
import org.jetbrains.kotlin.descriptors.ClassKind import org.jetbrains.kotlin.descriptors.ClassKind
import org.jetbrains.kotlin.descriptors.Modality
import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors
import org.jetbrains.kotlin.fir.analysis.diagnostics.reportOn import org.jetbrains.kotlin.fir.analysis.diagnostics.reportOn
import org.jetbrains.kotlin.fir.analysis.diagnostics.withSuppressedDiagnostics
import org.jetbrains.kotlin.fir.declarations.FirClass import org.jetbrains.kotlin.fir.declarations.FirClass
import org.jetbrains.kotlin.fir.declarations.FirRegularClass
import org.jetbrains.kotlin.fir.declarations.modality
import org.jetbrains.kotlin.fir.resolve.toSymbol import org.jetbrains.kotlin.fir.resolve.toSymbol
import org.jetbrains.kotlin.fir.symbols.impl.FirRegularClassSymbol
import org.jetbrains.kotlin.fir.types.ConeClassLikeType import org.jetbrains.kotlin.fir.types.ConeClassLikeType
import org.jetbrains.kotlin.fir.types.ConeNullability
import org.jetbrains.kotlin.fir.types.coneType import org.jetbrains.kotlin.fir.types.coneType
import org.jetbrains.kotlin.fir.types.isExtensionFunctionType
import org.jetbrains.kotlin.utils.addToStdlib.safeAs import org.jetbrains.kotlin.utils.addToStdlib.safeAs
object FirSupertypesChecker : FirClassChecker() { object FirSupertypesChecker : FirClassChecker() {
override fun check(declaration: FirClass<*>, context: CheckerContext, reporter: DiagnosticReporter) { override fun check(declaration: FirClass<*>, context: CheckerContext, reporter: DiagnosticReporter) {
val isInterface = declaration.classKind == ClassKind.INTERFACE val isInterface = declaration.classKind == ClassKind.INTERFACE
var nullableSupertypeReported = false
var extensionFunctionSupertypeReported = false
var interfaceWithSuperclassReported = !isInterface
var finalSupertypeReported = false
var singletonInSupertypeReported = false
var classAppeared = false
val superClassSymbols = hashSetOf<FirRegularClassSymbol>()
for (superTypeRef in declaration.superTypeRefs) { for (superTypeRef in declaration.superTypeRefs) {
val lookupTag = superTypeRef.coneType.safeAs<ConeClassLikeType>()?.lookupTag ?: continue withSuppressedDiagnostics(superTypeRef, context) {
val superTypeFir = lookupTag.toSymbol(context.session)?.fir val coneType = superTypeRef.coneType
if (!nullableSupertypeReported && coneType.nullability == ConeNullability.NULLABLE) {
reporter.reportOn(superTypeRef.source, FirErrors.NULLABLE_SUPERTYPE, context)
nullableSupertypeReported = true
}
if (!extensionFunctionSupertypeReported && coneType.isExtensionFunctionType) {
reporter.reportOn(superTypeRef.source, FirErrors.SUPERTYPE_IS_EXTENSION_FUNCTION_TYPE, context)
extensionFunctionSupertypeReported = true
}
val lookupTag = coneType.safeAs<ConeClassLikeType>()?.lookupTag ?: return@withSuppressedDiagnostics
val superTypeFir = lookupTag.toSymbol(context.session)?.fir
if (isInterface && superTypeFir is FirClass<*> && superTypeFir.classKind != ClassKind.INTERFACE) { if (superTypeFir is FirRegularClass) {
reporter.reportOn(superTypeRef.source, FirErrors.INTERFACE_WITH_SUPERCLASS, context) if (!superClassSymbols.add(superTypeFir.symbol)) {
return reporter.reportOn(superTypeRef.source, FirErrors.SUPERTYPE_APPEARS_TWICE, context)
}
if (superTypeFir.classKind != ClassKind.INTERFACE) {
if (classAppeared) {
reporter.reportOn(superTypeRef.source, FirErrors.MANY_CLASSES_IN_SUPERTYPE_LIST, context)
} else {
classAppeared = true
}
if (!interfaceWithSuperclassReported) {
reporter.reportOn(superTypeRef.source, FirErrors.INTERFACE_WITH_SUPERCLASS, context)
interfaceWithSuperclassReported = true
}
}
val isObject = superTypeFir.classKind == ClassKind.OBJECT
if (!finalSupertypeReported && !isObject && superTypeFir.modality == Modality.FINAL) {
reporter.reportOn(superTypeRef.source, FirErrors.FINAL_SUPERTYPE, context)
finalSupertypeReported = true
}
if (!singletonInSupertypeReported && isObject) {
reporter.reportOn(superTypeRef.source, FirErrors.SINGLETON_IN_SUPERTYPE, context)
singletonInSupertypeReported = true
}
}
} }
} }
} }
@@ -120,6 +120,7 @@ import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.EXPRESSION_OF_NUL
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.EXTENSION_IN_CLASS_REFERENCE_NOT_ALLOWED import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.EXTENSION_IN_CLASS_REFERENCE_NOT_ALLOWED
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.EXTENSION_PROPERTY_MUST_HAVE_ACCESSORS_OR_BE_ABSTRACT import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.EXTENSION_PROPERTY_MUST_HAVE_ACCESSORS_OR_BE_ABSTRACT
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.EXTENSION_PROPERTY_WITH_BACKING_FIELD import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.EXTENSION_PROPERTY_WITH_BACKING_FIELD
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.FINAL_SUPERTYPE
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.FINAL_UPPER_BOUND import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.FINAL_UPPER_BOUND
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.FORBIDDEN_VARARG_PARAMETER_TYPE import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.FORBIDDEN_VARARG_PARAMETER_TYPE
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.FUN_INTERFACE_CONSTRUCTOR_REFERENCE import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.FUN_INTERFACE_CONSTRUCTOR_REFERENCE
@@ -166,6 +167,7 @@ import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.LEAKED_IN_PLACE_L
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.LOCAL_ANNOTATION_CLASS_ERROR import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.LOCAL_ANNOTATION_CLASS_ERROR
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.LOCAL_INTERFACE_NOT_ALLOWED import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.LOCAL_INTERFACE_NOT_ALLOWED
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.LOCAL_OBJECT_NOT_ALLOWED import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.LOCAL_OBJECT_NOT_ALLOWED
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.MANY_CLASSES_IN_SUPERTYPE_LIST
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.MANY_COMPANION_OBJECTS import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.MANY_COMPANION_OBJECTS
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.MANY_IMPL_MEMBER_NOT_IMPLEMENTED import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.MANY_IMPL_MEMBER_NOT_IMPLEMENTED
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.MANY_INTERFACES_MEMBER_NOT_IMPLEMENTED import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.MANY_INTERFACES_MEMBER_NOT_IMPLEMENTED
@@ -204,6 +206,7 @@ import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.NO_GET_METHOD
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.NO_SET_METHOD import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.NO_SET_METHOD
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.NO_THIS import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.NO_THIS
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.NO_VALUE_FOR_PARAMETER import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.NO_VALUE_FOR_PARAMETER
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.NULLABLE_SUPERTYPE
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.NULLABLE_TYPE_IN_CLASS_LITERAL_LHS import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.NULLABLE_TYPE_IN_CLASS_LITERAL_LHS
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.NULLABLE_TYPE_OF_ANNOTATION_MEMBER import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.NULLABLE_TYPE_OF_ANNOTATION_MEMBER
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.ONLY_ONE_CLASS_BOUND_ALLOWED import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.ONLY_ONE_CLASS_BOUND_ALLOWED
@@ -254,10 +257,13 @@ import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.SEALED_SUPERTYPE
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.SEALED_SUPERTYPE_IN_LOCAL_CLASS import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.SEALED_SUPERTYPE_IN_LOCAL_CLASS
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.SECONDARY_CONSTRUCTOR_WITH_BODY_INSIDE_INLINE_CLASS import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.SECONDARY_CONSTRUCTOR_WITH_BODY_INSIDE_INLINE_CLASS
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.SETTER_VISIBILITY_INCONSISTENT_WITH_PROPERTY_VISIBILITY import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.SETTER_VISIBILITY_INCONSISTENT_WITH_PROPERTY_VISIBILITY
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.SINGLETON_IN_SUPERTYPE
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.SUPERCLASS_NOT_ACCESSIBLE_FROM_INTERFACE import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.SUPERCLASS_NOT_ACCESSIBLE_FROM_INTERFACE
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.SUPERTYPES_FOR_ANNOTATION_CLASS import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.SUPERTYPES_FOR_ANNOTATION_CLASS
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.SUPERTYPE_APPEARS_TWICE
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.SUPERTYPE_INITIALIZED_IN_INTERFACE import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.SUPERTYPE_INITIALIZED_IN_INTERFACE
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.SUPERTYPE_INITIALIZED_WITHOUT_PRIMARY_CONSTRUCTOR import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.SUPERTYPE_INITIALIZED_WITHOUT_PRIMARY_CONSTRUCTOR
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.SUPERTYPE_IS_EXTENSION_FUNCTION_TYPE
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.SUPERTYPE_NOT_A_CLASS_OR_INTERFACE import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.SUPERTYPE_NOT_A_CLASS_OR_INTERFACE
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.SUPERTYPE_NOT_INITIALIZED import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.SUPERTYPE_NOT_INITIALIZED
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.SUPER_CALL_FROM_PUBLIC_INLINE import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.SUPER_CALL_FROM_PUBLIC_INLINE
@@ -391,6 +397,12 @@ class FirDefaultErrorMessages : DefaultErrorMessages.Extension {
) )
map.put(SUPERTYPE_INITIALIZED_IN_INTERFACE, "Interfaces cannot initialize supertypes") map.put(SUPERTYPE_INITIALIZED_IN_INTERFACE, "Interfaces cannot initialize supertypes")
map.put(INTERFACE_WITH_SUPERCLASS, "An interface cannot inherit from a class") map.put(INTERFACE_WITH_SUPERCLASS, "An interface cannot inherit from a class")
map.put(FINAL_SUPERTYPE, "This type is final, so it cannot be inherited from")
map.put(SUPERTYPE_IS_EXTENSION_FUNCTION_TYPE, "Extension function type is not allowed as supertypes")
map.put(SINGLETON_IN_SUPERTYPE, "Cannot inherit from a singleton")
map.put(NULLABLE_SUPERTYPE, "A supertype cannot be nullable")
map.put(MANY_CLASSES_IN_SUPERTYPE_LIST, "Only one class may appear in a supertype list")
map.put(SUPERTYPE_APPEARS_TWICE, "A supertype appears twice")
map.put(CLASS_IN_SUPERTYPE_FOR_ENUM, "Enum class cannot inherit from classes") map.put(CLASS_IN_SUPERTYPE_FOR_ENUM, "Enum class cannot inherit from classes")
map.put(SEALED_SUPERTYPE, "This type is sealed, so it can be inherited by only its own nested classes or objects") map.put(SEALED_SUPERTYPE, "This type is sealed, so it can be inherited by only its own nested classes or objects")
map.put(SEALED_SUPERTYPE_IN_LOCAL_CLASS, "Local class cannot extend a sealed class") map.put(SEALED_SUPERTYPE_IN_LOCAL_CLASS, "Local class cannot extend a sealed class")
@@ -687,6 +687,26 @@ object LightTreePositioningStrategies {
return super.mark(node, startOffset, endOffset, tree) return super.mark(node, startOffset, endOffset, tree)
} }
} }
val QUESTION_MARK_BY_TYPE: LightTreePositioningStrategy = object : LightTreePositioningStrategy() {
override fun mark(
node: LighterASTNode,
startOffset: Int,
endOffset: Int,
tree: FlyweightCapableTreeStructure<LighterASTNode>
): List<TextRange> {
if (node.tokenType == KtNodeTypes.TYPE_REFERENCE) {
val typeElement = tree.findChildByType(node, KtNodeTypes.NULLABLE_TYPE)
if (typeElement != null) {
val question = tree.findChildByType(typeElement, KtTokens.QUEST)
if (question != null) {
return markElement(question, startOffset, endOffset, tree, node)
}
}
}
return super.mark(node, startOffset, endOffset, tree)
}
}
} }
fun FirSourceElement.hasValOrVar(): Boolean = fun FirSourceElement.hasValOrVar(): Boolean =
@@ -237,4 +237,9 @@ object SourceElementPositioningStrategies {
LightTreePositioningStrategies.RESERVED_UNDERSCORE, LightTreePositioningStrategies.RESERVED_UNDERSCORE,
PositioningStrategies.RESERVED_UNDERSCORE PositioningStrategies.RESERVED_UNDERSCORE
) )
val QUESTION_MARK_BY_TYPE = SourceElementPositioningStrategy(
LightTreePositioningStrategies.QUESTION_MARK_BY_TYPE,
PositioningStrategies.QUESTION_MARK_BY_TYPE
)
} }
@@ -590,6 +590,17 @@ object PositioningStrategies {
} }
} }
@JvmField
val QUESTION_MARK_BY_TYPE: PositioningStrategy<KtTypeReference> = object : PositioningStrategy<KtTypeReference>() {
override fun mark(element: KtTypeReference): List<TextRange> {
val typeElement = element.typeElement
if (typeElement is KtNullableType) {
return markNode(typeElement.questionMarkNode)
}
return super.mark(element)
}
}
@JvmField @JvmField
val CALL_EXPRESSION: PositioningStrategy<PsiElement> = object : PositioningStrategy<PsiElement>() { val CALL_EXPRESSION: PositioningStrategy<PsiElement> = object : PositioningStrategy<PsiElement>() {
override fun mark(element: PsiElement): List<TextRange> { override fun mark(element: PsiElement): List<TextRange> {
+3
View File
@@ -5,6 +5,9 @@ compiler/testData/cli/jvm/firError.kt:5:13: error: variable 'x' must be initiali
println(x) println(x)
^ ^
compiler/testData/cli/jvm/firError.kt:10:16: error: public subclass exposes its private-in-file supertype 'Private' compiler/testData/cli/jvm/firError.kt:10:16: error: public subclass exposes its private-in-file supertype 'Private'
class Public : Private() {
^
compiler/testData/cli/jvm/firError.kt:10:16: error: this type is final, so it cannot be inherited from
class Public : Private() { class Public : Private() {
^ ^
compiler/testData/cli/jvm/firError.kt:11:5: error: property must be initialized or be abstract compiler/testData/cli/jvm/firError.kt:11:5: error: property must be initialized or be abstract
+1 -1
View File
@@ -14,7 +14,7 @@ class WithPC1(a : Int) {
} }
class Foo() : WithPC0, <!SYNTAX!>this<!>() { class Foo() : <!FINAL_SUPERTYPE!>WithPC0<!>, <!SYNTAX!>this<!>() {
} }
@@ -3,4 +3,4 @@ interface B<T> {}
interface C<T> {} interface C<T> {}
interface D<T> {} interface D<T> {}
interface Test : A<in Int>, B<out Int>, C<*>???, D<Int> {} interface Test : A<in Int>, B<out Int>, C<*>??<!NULLABLE_SUPERTYPE!>?<!>, D<Int> {}
@@ -28,22 +28,22 @@ interface Test1 : <!INTERFACE_WITH_SUPERCLASS, SUPERTYPE_INITIALIZED_IN_INTERFAC
interface Test2 : <!INTERFACE_WITH_SUPERCLASS!>C2<!> {} interface Test2 : <!INTERFACE_WITH_SUPERCLASS!>C2<!> {}
interface Test3 : <!INTERFACE_WITH_SUPERCLASS!>C2<!>, C3 {} interface Test3 : <!INTERFACE_WITH_SUPERCLASS!>C2<!>, <!MANY_CLASSES_IN_SUPERTYPE_LIST!>C3<!> {}
interface Test4 : T1 {} interface Test4 : T1 {}
interface Test5 : T1, T1 {} interface Test5 : T1, <!SUPERTYPE_APPEARS_TWICE!>T1<!> {}
interface Test6 : <!INTERFACE_WITH_SUPERCLASS!>C1<!> {} interface Test6 : <!FINAL_SUPERTYPE, INTERFACE_WITH_SUPERCLASS!>C1<!> {}
class CTest1() : OC1() {} class CTest1() : OC1() {}
class CTest2 : <!SUPERTYPE_NOT_INITIALIZED!>C2<!> {} class CTest2 : <!SUPERTYPE_NOT_INITIALIZED!>C2<!> {}
class CTest3 : <!SUPERTYPE_NOT_INITIALIZED!>C2<!>, C3 {} class CTest3 : <!SUPERTYPE_NOT_INITIALIZED!>C2<!>, <!MANY_CLASSES_IN_SUPERTYPE_LIST!>C3<!> {}
class CTest4 : T1 {} class CTest4 : T1 {}
class CTest5 : T1, T1 {} class CTest5 : T1, <!SUPERTYPE_APPEARS_TWICE!>T1<!> {}
class CTest6 : <!SUPERTYPE_NOT_INITIALIZED!>C1<!> {} class CTest6 : <!FINAL_SUPERTYPE, SUPERTYPE_NOT_INITIALIZED!>C1<!> {}
@@ -10,4 +10,4 @@ data class Nasty(val z: Int, val y: Int): Base(z)
data class Complex(val y: Int): SuperInterface, SuperClass() data class Complex(val y: Int): SuperInterface, SuperClass()
data class SubData(val sss: String) : Complex(42) data class SubData(val sss: String) : <!FINAL_SUPERTYPE!>Complex<!>(42)
@@ -23,6 +23,6 @@ public abstract class MyClass : Base1, Base2 {
} }
} }
<!DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE!>class A<!> : MyClass(), Base1 by Delegate1(), Base1 by Delegate2() { <!DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE!>class A<!> : MyClass(), Base1 by Delegate1(), <!SUPERTYPE_APPEARS_TWICE!>Base1<!> by Delegate2() {
} }
@@ -1,7 +1,7 @@
// FILE: test.kt // FILE: test.kt
enum class MyEnum(): <!CLASS_IN_SUPERTYPE_FOR_ENUM!>MyClass<!>() {} enum class MyEnum(): <!CLASS_IN_SUPERTYPE_FOR_ENUM!>MyClass<!>() {}
enum class MyEnum2(): MyTrait {} enum class MyEnum2(): MyTrait {}
enum class MyEnum3(): <!CLASS_IN_SUPERTYPE_FOR_ENUM!>MyEnumBase<!>() {} enum class MyEnum3(): <!CLASS_IN_SUPERTYPE_FOR_ENUM, FINAL_SUPERTYPE!>MyEnumBase<!>() {}
open class MyClass() {} open class MyClass() {}
@@ -8,6 +8,6 @@ open enum class MyEnum() {
enum class MyEnum2() {} enum class MyEnum2() {}
class MyClass(): <!INVISIBLE_REFERENCE!>MyEnum2<!>() {} class MyClass(): <!FINAL_SUPERTYPE, INVISIBLE_REFERENCE!>MyEnum2<!>() {}
class MyClass2(): <!UNRESOLVED_REFERENCE!>MyJavaEnum<!>() {} class MyClass2(): <!FINAL_SUPERTYPE, UNRESOLVED_REFERENCE!>MyJavaEnum<!>() {}
@@ -1,19 +0,0 @@
// FILE: a.kt
package foo
object Bar {
fun bar() {}
}
// FILE: b.kt
package baz
import foo.Bar
class C: Bar
fun test() {
Bar.bar()
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// FILE: a.kt // FILE: a.kt
package foo package foo
@@ -11,4 +11,4 @@ package a
import pack1.SomeClass.* import pack1.SomeClass.*
private class X : <!EXPOSED_SUPER_CLASS, INVISIBLE_REFERENCE!>N<!>() private class X : <!EXPOSED_SUPER_CLASS, FINAL_SUPERTYPE, INVISIBLE_REFERENCE!>N<!>()
@@ -1,6 +1,6 @@
class Test { class Test {
@`InnerAnnotation` @InnerAnnotation @`InnerAnnotation` @InnerAnnotation
companion object : StaticClass(), <!UNRESOLVED_REFERENCE!>InnerClass<!>() { companion object : StaticClass(), <!MANY_CLASSES_IN_SUPERTYPE_LIST, UNRESOLVED_REFERENCE!>InnerClass<!>() {
} }
+4 -4
View File
@@ -6,12 +6,12 @@ class Outer {
class FinalInner class FinalInner
class Nested1 : OpenNested() class Nested1 : OpenNested()
class Nested2 : FinalNested() class Nested2 : <!FINAL_SUPERTYPE!>FinalNested<!>()
class Nested3 : <!UNRESOLVED_REFERENCE!>OpenInner<!>() class Nested3 : <!UNRESOLVED_REFERENCE!>OpenInner<!>()
class Nested4 : FinalInner() class Nested4 : <!FINAL_SUPERTYPE!>FinalInner<!>()
inner class Inner1 : OpenNested() inner class Inner1 : OpenNested()
inner class Inner2 : FinalNested() inner class Inner2 : <!FINAL_SUPERTYPE!>FinalNested<!>()
inner class Inner3 : OpenInner() inner class Inner3 : OpenInner()
inner class Inner4 : FinalInner() inner class Inner4 : <!FINAL_SUPERTYPE!>FinalInner<!>()
} }
@@ -1,5 +1,5 @@
interface A interface A
interface X: A?? { interface X: A?<!NULLABLE_SUPERTYPE!>?<!> {
} }
+1 -1
View File
@@ -14,7 +14,7 @@ package toplevelObjectDeclarations
} }
}<!> }<!>
object B : A {} object B : <!SINGLETON_IN_SUPERTYPE!>A<!> {}
val x = A.foo() val x = A.foo()
@@ -1,5 +0,0 @@
package toplevelObjectDeclarations
object CObj {}
object DOjb : CObj {}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
package toplevelObjectDeclarations package toplevelObjectDeclarations
object CObj {} object CObj {}
@@ -1,28 +0,0 @@
class Foo {
<!NON_FINAL_MEMBER_IN_FINAL_CLASS!>open<!> fun openFoo() {}
fun finalFoo() {}
}
class Bar : Foo() {
override fun openFoo() {}
<!OVERRIDING_FINAL_MEMBER!>override<!> fun finalFoo() {}
}
open class A1 {
open fun foo() {}
}
class B1 : A1()
class C1 : B1() {
override fun foo() {}
}
abstract class A2 {
abstract fun foo()
}
<!ABSTRACT_CLASS_MEMBER_NOT_IMPLEMENTED!>class B2<!> : A2()
class C2 : B2() {
override fun foo() {}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
class Foo { class Foo {
<!NON_FINAL_MEMBER_IN_FINAL_CLASS!>open<!> fun openFoo() {} <!NON_FINAL_MEMBER_IN_FINAL_CLASS!>open<!> fun openFoo() {}
fun finalFoo() {} fun finalFoo() {}
@@ -7,7 +7,7 @@ val bImpl: B.Companion.Interface
get() = null!! get() = null!!
interface A { interface A {
companion object : Nested(), Interface by aImpl, I<Nested, Interface> { companion object : <!FINAL_SUPERTYPE!>Nested<!>(), Interface by aImpl, I<Nested, Interface> {
class Nested class Nested
@@ -16,7 +16,7 @@ interface A {
} }
class B { class B {
companion object : Nested(), Interface by aImpl, I<Nested, Interface> { companion object : <!FINAL_SUPERTYPE!>Nested<!>(), Interface by aImpl, I<Nested, Interface> {
class Nested class Nested
@@ -1,24 +0,0 @@
class A : Double.() -> Unit {
override fun invoke(p1: Double) {}
}
class B : Int.(Double) -> Unit {
override fun invoke(p1: Int, p2: Double) {}
}
open class C {}
abstract class A0 : C.() -> Int
abstract class A1 : C.(Int) -> Int
abstract class A2 : C.(Int, String) -> Int
open class D<T> {}
abstract class B0<T> : D<T>.() -> Int
abstract class B1<T> : D<T>.(C) -> Int
abstract class B2<T> : D<T>.(T, C) -> T
interface E<T> {}
abstract class C0: C(), Int.() -> Double
abstract class C1<T>: C(), E<T>, Int.(C) -> Double
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
class A : <!SUPERTYPE_IS_EXTENSION_FUNCTION_TYPE!>Double.() -> Unit<!> { class A : <!SUPERTYPE_IS_EXTENSION_FUNCTION_TYPE!>Double.() -> Unit<!> {
override fun invoke(p1: Double) {} override fun invoke(p1: Double) {}
} }
@@ -1,10 +1,10 @@
open class bar() open class bar()
interface <!CONSTRUCTOR_IN_INTERFACE!>Foo()<!> : <!INTERFACE_WITH_SUPERCLASS, SUPERTYPE_INITIALIZED_IN_INTERFACE!>bar<!>(), bar, bar { interface <!CONSTRUCTOR_IN_INTERFACE!>Foo()<!> : <!INTERFACE_WITH_SUPERCLASS, SUPERTYPE_INITIALIZED_IN_INTERFACE!>bar<!>(), <!MANY_CLASSES_IN_SUPERTYPE_LIST, SUPERTYPE_APPEARS_TWICE!>bar<!>, <!MANY_CLASSES_IN_SUPERTYPE_LIST, SUPERTYPE_APPEARS_TWICE!>bar<!> {
} }
interface Foo2 : <!INTERFACE_WITH_SUPERCLASS!>bar<!>, Foo { interface Foo2 : <!INTERFACE_WITH_SUPERCLASS!>bar<!>, Foo {
} }
open class Foo1() : bar(), bar, Foo, <!UNRESOLVED_REFERENCE!>Foo<!>() {} open class Foo1() : bar(), <!MANY_CLASSES_IN_SUPERTYPE_LIST, SUPERTYPE_APPEARS_TWICE!>bar<!>, Foo, <!SUPERTYPE_APPEARS_TWICE, UNRESOLVED_REFERENCE!>Foo<!>() {}
open class Foo12 : bar(), bar {} open class Foo12 : bar(), <!MANY_CLASSES_IN_SUPERTYPE_LIST, SUPERTYPE_APPEARS_TWICE!>bar<!> {}
@@ -29,7 +29,7 @@ interface Supertype1 : suspend () -> Unit {
} }
interface Supertype2 : suspend String.() -> Unit { interface Supertype2 : <!SUPERTYPE_IS_EXTENSION_FUNCTION_TYPE!>suspend String.() -> Unit<!> {
} }
@@ -9,7 +9,7 @@ fun test() {
a <!ARGUMENT_TYPE_MISMATCH!>{}<!> a <!ARGUMENT_TYPE_MISMATCH!>{}<!>
} }
<!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>class Ext<!> : String.() -> Unit { <!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>class Ext<!> : <!SUPERTYPE_IS_EXTENSION_FUNCTION_TYPE!>String.() -> Unit<!> {
} }
fun test2() { fun test2() {
@@ -308,6 +308,42 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert
token, token,
) )
} }
add(FirErrors.FINAL_SUPERTYPE) { firDiagnostic ->
FinalSupertypeImpl(
firDiagnostic as FirPsiDiagnostic<*>,
token,
)
}
add(FirErrors.SUPERTYPE_IS_EXTENSION_FUNCTION_TYPE) { firDiagnostic ->
SupertypeIsExtensionFunctionTypeImpl(
firDiagnostic as FirPsiDiagnostic<*>,
token,
)
}
add(FirErrors.SINGLETON_IN_SUPERTYPE) { firDiagnostic ->
SingletonInSupertypeImpl(
firDiagnostic as FirPsiDiagnostic<*>,
token,
)
}
add(FirErrors.NULLABLE_SUPERTYPE) { firDiagnostic ->
NullableSupertypeImpl(
firDiagnostic as FirPsiDiagnostic<*>,
token,
)
}
add(FirErrors.MANY_CLASSES_IN_SUPERTYPE_LIST) { firDiagnostic ->
ManyClassesInSupertypeListImpl(
firDiagnostic as FirPsiDiagnostic<*>,
token,
)
}
add(FirErrors.SUPERTYPE_APPEARS_TWICE) { firDiagnostic ->
SupertypeAppearsTwiceImpl(
firDiagnostic as FirPsiDiagnostic<*>,
token,
)
}
add(FirErrors.CLASS_IN_SUPERTYPE_FOR_ENUM) { firDiagnostic -> add(FirErrors.CLASS_IN_SUPERTYPE_FOR_ENUM) { firDiagnostic ->
ClassInSupertypeForEnumImpl( ClassInSupertypeForEnumImpl(
firDiagnostic as FirPsiDiagnostic<*>, firDiagnostic as FirPsiDiagnostic<*>,
@@ -220,28 +220,52 @@ sealed class KtFirDiagnostic<PSI: PsiElement> : KtDiagnosticWithPsi<PSI> {
override val diagnosticClass get() = SuperclassNotAccessibleFromInterface::class override val diagnosticClass get() = SuperclassNotAccessibleFromInterface::class
} }
abstract class QualifiedSupertypeExtendedByOtherSupertype : KtFirDiagnostic<PsiElement>() { abstract class QualifiedSupertypeExtendedByOtherSupertype : KtFirDiagnostic<KtTypeReference>() {
override val diagnosticClass get() = QualifiedSupertypeExtendedByOtherSupertype::class override val diagnosticClass get() = QualifiedSupertypeExtendedByOtherSupertype::class
abstract val otherSuperType: KtClassLikeSymbol abstract val otherSuperType: KtClassLikeSymbol
} }
abstract class SupertypeInitializedInInterface : KtFirDiagnostic<PsiElement>() { abstract class SupertypeInitializedInInterface : KtFirDiagnostic<KtTypeReference>() {
override val diagnosticClass get() = SupertypeInitializedInInterface::class override val diagnosticClass get() = SupertypeInitializedInInterface::class
} }
abstract class InterfaceWithSuperclass : KtFirDiagnostic<PsiElement>() { abstract class InterfaceWithSuperclass : KtFirDiagnostic<KtTypeReference>() {
override val diagnosticClass get() = InterfaceWithSuperclass::class override val diagnosticClass get() = InterfaceWithSuperclass::class
} }
abstract class ClassInSupertypeForEnum : KtFirDiagnostic<PsiElement>() { abstract class FinalSupertype : KtFirDiagnostic<KtTypeReference>() {
override val diagnosticClass get() = FinalSupertype::class
}
abstract class SupertypeIsExtensionFunctionType : KtFirDiagnostic<KtTypeReference>() {
override val diagnosticClass get() = SupertypeIsExtensionFunctionType::class
}
abstract class SingletonInSupertype : KtFirDiagnostic<KtTypeReference>() {
override val diagnosticClass get() = SingletonInSupertype::class
}
abstract class NullableSupertype : KtFirDiagnostic<KtTypeReference>() {
override val diagnosticClass get() = NullableSupertype::class
}
abstract class ManyClassesInSupertypeList : KtFirDiagnostic<KtTypeReference>() {
override val diagnosticClass get() = ManyClassesInSupertypeList::class
}
abstract class SupertypeAppearsTwice : KtFirDiagnostic<KtTypeReference>() {
override val diagnosticClass get() = SupertypeAppearsTwice::class
}
abstract class ClassInSupertypeForEnum : KtFirDiagnostic<KtTypeReference>() {
override val diagnosticClass get() = ClassInSupertypeForEnum::class override val diagnosticClass get() = ClassInSupertypeForEnum::class
} }
abstract class SealedSupertype : KtFirDiagnostic<PsiElement>() { abstract class SealedSupertype : KtFirDiagnostic<KtTypeReference>() {
override val diagnosticClass get() = SealedSupertype::class override val diagnosticClass get() = SealedSupertype::class
} }
abstract class SealedSupertypeInLocalClass : KtFirDiagnostic<PsiElement>() { abstract class SealedSupertypeInLocalClass : KtFirDiagnostic<KtTypeReference>() {
override val diagnosticClass get() = SealedSupertypeInLocalClass::class override val diagnosticClass get() = SealedSupertypeInLocalClass::class
} }
@@ -339,42 +339,84 @@ internal class QualifiedSupertypeExtendedByOtherSupertypeImpl(
override val otherSuperType: KtClassLikeSymbol, override val otherSuperType: KtClassLikeSymbol,
firDiagnostic: FirPsiDiagnostic<*>, firDiagnostic: FirPsiDiagnostic<*>,
override val token: ValidityToken, override val token: ValidityToken,
) : KtFirDiagnostic.QualifiedSupertypeExtendedByOtherSupertype(), KtAbstractFirDiagnostic<PsiElement> { ) : KtFirDiagnostic.QualifiedSupertypeExtendedByOtherSupertype(), KtAbstractFirDiagnostic<KtTypeReference> {
override val firDiagnostic: FirPsiDiagnostic<*> by weakRef(firDiagnostic) override val firDiagnostic: FirPsiDiagnostic<*> by weakRef(firDiagnostic)
} }
internal class SupertypeInitializedInInterfaceImpl( internal class SupertypeInitializedInInterfaceImpl(
firDiagnostic: FirPsiDiagnostic<*>, firDiagnostic: FirPsiDiagnostic<*>,
override val token: ValidityToken, override val token: ValidityToken,
) : KtFirDiagnostic.SupertypeInitializedInInterface(), KtAbstractFirDiagnostic<PsiElement> { ) : KtFirDiagnostic.SupertypeInitializedInInterface(), KtAbstractFirDiagnostic<KtTypeReference> {
override val firDiagnostic: FirPsiDiagnostic<*> by weakRef(firDiagnostic) override val firDiagnostic: FirPsiDiagnostic<*> by weakRef(firDiagnostic)
} }
internal class InterfaceWithSuperclassImpl( internal class InterfaceWithSuperclassImpl(
firDiagnostic: FirPsiDiagnostic<*>, firDiagnostic: FirPsiDiagnostic<*>,
override val token: ValidityToken, override val token: ValidityToken,
) : KtFirDiagnostic.InterfaceWithSuperclass(), KtAbstractFirDiagnostic<PsiElement> { ) : KtFirDiagnostic.InterfaceWithSuperclass(), KtAbstractFirDiagnostic<KtTypeReference> {
override val firDiagnostic: FirPsiDiagnostic<*> by weakRef(firDiagnostic)
}
internal class FinalSupertypeImpl(
firDiagnostic: FirPsiDiagnostic<*>,
override val token: ValidityToken,
) : KtFirDiagnostic.FinalSupertype(), KtAbstractFirDiagnostic<KtTypeReference> {
override val firDiagnostic: FirPsiDiagnostic<*> by weakRef(firDiagnostic)
}
internal class SupertypeIsExtensionFunctionTypeImpl(
firDiagnostic: FirPsiDiagnostic<*>,
override val token: ValidityToken,
) : KtFirDiagnostic.SupertypeIsExtensionFunctionType(), KtAbstractFirDiagnostic<KtTypeReference> {
override val firDiagnostic: FirPsiDiagnostic<*> by weakRef(firDiagnostic)
}
internal class SingletonInSupertypeImpl(
firDiagnostic: FirPsiDiagnostic<*>,
override val token: ValidityToken,
) : KtFirDiagnostic.SingletonInSupertype(), KtAbstractFirDiagnostic<KtTypeReference> {
override val firDiagnostic: FirPsiDiagnostic<*> by weakRef(firDiagnostic)
}
internal class NullableSupertypeImpl(
firDiagnostic: FirPsiDiagnostic<*>,
override val token: ValidityToken,
) : KtFirDiagnostic.NullableSupertype(), KtAbstractFirDiagnostic<KtTypeReference> {
override val firDiagnostic: FirPsiDiagnostic<*> by weakRef(firDiagnostic)
}
internal class ManyClassesInSupertypeListImpl(
firDiagnostic: FirPsiDiagnostic<*>,
override val token: ValidityToken,
) : KtFirDiagnostic.ManyClassesInSupertypeList(), KtAbstractFirDiagnostic<KtTypeReference> {
override val firDiagnostic: FirPsiDiagnostic<*> by weakRef(firDiagnostic)
}
internal class SupertypeAppearsTwiceImpl(
firDiagnostic: FirPsiDiagnostic<*>,
override val token: ValidityToken,
) : KtFirDiagnostic.SupertypeAppearsTwice(), KtAbstractFirDiagnostic<KtTypeReference> {
override val firDiagnostic: FirPsiDiagnostic<*> by weakRef(firDiagnostic) override val firDiagnostic: FirPsiDiagnostic<*> by weakRef(firDiagnostic)
} }
internal class ClassInSupertypeForEnumImpl( internal class ClassInSupertypeForEnumImpl(
firDiagnostic: FirPsiDiagnostic<*>, firDiagnostic: FirPsiDiagnostic<*>,
override val token: ValidityToken, override val token: ValidityToken,
) : KtFirDiagnostic.ClassInSupertypeForEnum(), KtAbstractFirDiagnostic<PsiElement> { ) : KtFirDiagnostic.ClassInSupertypeForEnum(), KtAbstractFirDiagnostic<KtTypeReference> {
override val firDiagnostic: FirPsiDiagnostic<*> by weakRef(firDiagnostic) override val firDiagnostic: FirPsiDiagnostic<*> by weakRef(firDiagnostic)
} }
internal class SealedSupertypeImpl( internal class SealedSupertypeImpl(
firDiagnostic: FirPsiDiagnostic<*>, firDiagnostic: FirPsiDiagnostic<*>,
override val token: ValidityToken, override val token: ValidityToken,
) : KtFirDiagnostic.SealedSupertype(), KtAbstractFirDiagnostic<PsiElement> { ) : KtFirDiagnostic.SealedSupertype(), KtAbstractFirDiagnostic<KtTypeReference> {
override val firDiagnostic: FirPsiDiagnostic<*> by weakRef(firDiagnostic) override val firDiagnostic: FirPsiDiagnostic<*> by weakRef(firDiagnostic)
} }
internal class SealedSupertypeInLocalClassImpl( internal class SealedSupertypeInLocalClassImpl(
firDiagnostic: FirPsiDiagnostic<*>, firDiagnostic: FirPsiDiagnostic<*>,
override val token: ValidityToken, override val token: ValidityToken,
) : KtFirDiagnostic.SealedSupertypeInLocalClass(), KtAbstractFirDiagnostic<PsiElement> { ) : KtFirDiagnostic.SealedSupertypeInLocalClass(), KtAbstractFirDiagnostic<KtTypeReference> {
override val firDiagnostic: FirPsiDiagnostic<*> by weakRef(firDiagnostic) override val firDiagnostic: FirPsiDiagnostic<*> by weakRef(firDiagnostic)
} }
+1 -1
View File
@@ -18,7 +18,7 @@ class WithPC1(a : Int) {
} }
class Foo() : WithPC0(), <error descr="Type expected"><error descr="[SYNTAX] Syntax error"><error descr="[SYNTAX] Syntax error">this</error></error></error>() { class Foo() : <error descr="[FINAL_SUPERTYPE] This type is final, so it cannot be inherited from">WithPC0</error>(), <error descr="Type expected"><error descr="[SYNTAX] Syntax error"><error descr="[SYNTAX] Syntax error">this</error></error></error>() {
} }
+1 -1
View File
@@ -13,7 +13,7 @@ package toplevelObjectDeclarations
} }
} }
object B : A {} object B : <error descr="[SINGLETON_IN_SUPERTYPE] Cannot inherit from a singleton">A</error> {}
val x = A.foo() val x = A.foo()
+1 -1
View File
@@ -3,4 +3,4 @@ interface B<T> {}
interface C<T> {} interface C<T> {}
interface D<T> {} interface D<T> {}
interface Test : A<in Int>, B<out Int>, C<*>???, D<Int> {} interface Test : A<in Int>, B<out Int>, C<*>??<error descr="[NULLABLE_SUPERTYPE] A supertype cannot be nullable">?</error>, D<Int> {}
+6 -6
View File
@@ -28,22 +28,22 @@ interface Test1 : <error descr="[INTERFACE_WITH_SUPERCLASS] An interface cannot
interface Test2 : <error descr="[INTERFACE_WITH_SUPERCLASS] An interface cannot inherit from a class">C2</error> {} interface Test2 : <error descr="[INTERFACE_WITH_SUPERCLASS] An interface cannot inherit from a class">C2</error> {}
interface Test3 : <error descr="[INTERFACE_WITH_SUPERCLASS] An interface cannot inherit from a class">C2</error>, C3 {} interface Test3 : <error descr="[INTERFACE_WITH_SUPERCLASS] An interface cannot inherit from a class">C2</error>, <error descr="[MANY_CLASSES_IN_SUPERTYPE_LIST] Only one class may appear in a supertype list">C3</error> {}
interface Test4 : T1 {} interface Test4 : T1 {}
interface Test5 : T1, T1 {} interface Test5 : T1, <error descr="[SUPERTYPE_APPEARS_TWICE] A supertype appears twice">T1</error> {}
interface Test6 : <error descr="[INTERFACE_WITH_SUPERCLASS] An interface cannot inherit from a class">C1</error> {} interface Test6 : <error descr="[FINAL_SUPERTYPE] This type is final, so it cannot be inherited from"><error descr="[INTERFACE_WITH_SUPERCLASS] An interface cannot inherit from a class">C1</error></error> {}
class CTest1() : OC1() {} class CTest1() : OC1() {}
class CTest2 : <error descr="[SUPERTYPE_NOT_INITIALIZED] This type has a constructor, and thus must be initialized here">C2</error> {} class CTest2 : <error descr="[SUPERTYPE_NOT_INITIALIZED] This type has a constructor, and thus must be initialized here">C2</error> {}
class CTest3 : <error descr="[SUPERTYPE_NOT_INITIALIZED] This type has a constructor, and thus must be initialized here">C2</error>, C3 {} class CTest3 : <error descr="[SUPERTYPE_NOT_INITIALIZED] This type has a constructor, and thus must be initialized here">C2</error>, <error descr="[MANY_CLASSES_IN_SUPERTYPE_LIST] Only one class may appear in a supertype list">C3</error> {}
class CTest4 : T1 {} class CTest4 : T1 {}
class CTest5 : T1, T1 {} class CTest5 : T1, <error descr="[SUPERTYPE_APPEARS_TWICE] A supertype appears twice">T1</error> {}
class CTest6 : <error descr="[SUPERTYPE_NOT_INITIALIZED] This type has a constructor, and thus must be initialized here">C1</error> {} class CTest6 : <error descr="[FINAL_SUPERTYPE] This type is final, so it cannot be inherited from"><error descr="[SUPERTYPE_NOT_INITIALIZED] This type has a constructor, and thus must be initialized here">C1</error></error> {}
+3 -3
View File
@@ -1,10 +1,10 @@
open class bar() open class bar()
interface <error descr="[CONSTRUCTOR_IN_INTERFACE] An interface may not have a constructor">Foo()</error> : <error descr="[INTERFACE_WITH_SUPERCLASS] An interface cannot inherit from a class"><error descr="[SUPERTYPE_INITIALIZED_IN_INTERFACE] Interfaces cannot initialize supertypes">bar</error></error>(), bar, bar { interface <error descr="[CONSTRUCTOR_IN_INTERFACE] An interface may not have a constructor">Foo()</error> : <error descr="[INTERFACE_WITH_SUPERCLASS] An interface cannot inherit from a class"><error descr="[SUPERTYPE_INITIALIZED_IN_INTERFACE] Interfaces cannot initialize supertypes">bar</error></error>(), <error descr="[MANY_CLASSES_IN_SUPERTYPE_LIST] Only one class may appear in a supertype list"><error descr="[SUPERTYPE_APPEARS_TWICE] A supertype appears twice">bar</error></error>, <error descr="[MANY_CLASSES_IN_SUPERTYPE_LIST] Only one class may appear in a supertype list"><error descr="[SUPERTYPE_APPEARS_TWICE] A supertype appears twice">bar</error></error> {
} }
interface Foo2 : <error descr="[INTERFACE_WITH_SUPERCLASS] An interface cannot inherit from a class">bar</error>, Foo { interface Foo2 : <error descr="[INTERFACE_WITH_SUPERCLASS] An interface cannot inherit from a class">bar</error>, Foo {
} }
open class Foo1() : bar(), bar, Foo, <error descr="[UNRESOLVED_REFERENCE] Unresolved reference: <init>">Foo</error>() {} open class Foo1() : bar(), <error descr="[MANY_CLASSES_IN_SUPERTYPE_LIST] Only one class may appear in a supertype list"><error descr="[SUPERTYPE_APPEARS_TWICE] A supertype appears twice">bar</error></error>, Foo, <error descr="[SUPERTYPE_APPEARS_TWICE] A supertype appears twice"><error descr="[UNRESOLVED_REFERENCE] Unresolved reference: <init>">Foo</error></error>() {}
open class Foo12 : bar(), bar {} open class Foo12 : bar(), <error descr="[MANY_CLASSES_IN_SUPERTYPE_LIST] Only one class may appear in a supertype list"><error descr="[SUPERTYPE_APPEARS_TWICE] A supertype appears twice">bar</error></error> {}
@@ -1,38 +0,0 @@
================ Step #1 =================
Compiling files:
src/A.kt
src/AChild.kt
src/AGrandChild.kt
src/ATypeParameter.kt
src/classLiteral.kt
src/functionParameter.kt
src/getA.kt
src/importA.kt
src/importAGrandChild.kt
src/importStar.kt
src/referencedByFqName.kt
src/returnType.kt
src/returnTypeImplicit.kt
End of files
Exit code: OK
================ Step #2 =================
Compiling files:
src/A.kt
src/AChild.kt
src/AGrandChild.kt
src/ATypeParameter.kt
src/classLiteral.kt
src/functionParameter.kt
src/getA.kt
src/importA.kt
src/importAGrandChild.kt
src/importStar.kt
src/referencedByFqName.kt
src/returnType.kt
src/returnTypeImplicit.kt
End of files
Exit code: OK