FIR checker: report SUPERTYPE_NOT_INITIALIZED
Combined this and the checker of SUPERTYPE_INITIALIZED_WITHOUT_PRIMARY_CONSTRUCTOR together. Also fixed SUPERTYPE_INITIALIZED_WITHOUT_PRIMARY_CONSTRUCTOR incorrectly repoted as warning instead of error.
This commit is contained in:
committed by
Dmitriy Novozhilov
parent
6134c00698
commit
56bec6997c
@@ -21,7 +21,7 @@ class LinkedList<T> : java.util.LinkedList<T>()
|
|||||||
|
|
||||||
package util
|
package util
|
||||||
|
|
||||||
class HashSet<T> : java.util.HashSet<T>
|
class HashSet<T> : <!SUPERTYPE_NOT_INITIALIZED!>java.util.HashSet<T><!>
|
||||||
|
|
||||||
// FILE: main.kt
|
// FILE: main.kt
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -16,7 +16,7 @@ fun test(z: Int, c: Char) {}
|
|||||||
|
|
||||||
}<!>
|
}<!>
|
||||||
|
|
||||||
<!REDECLARATION!>class B : A {
|
<!REDECLARATION!>class B : <!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)<!> {}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ class A {
|
|||||||
fun f() {}
|
fun f() {}
|
||||||
}
|
}
|
||||||
|
|
||||||
class B : A {
|
class B : <!SUPERTYPE_NOT_INITIALIZED!>A<!> {
|
||||||
fun g() {
|
fun g() {
|
||||||
<!NOT_A_SUPERTYPE!>super<String><!>.<!UNRESOLVED_REFERENCE!>f<!>()
|
<!NOT_A_SUPERTYPE!>super<String><!>.<!UNRESOLVED_REFERENCE!>f<!>()
|
||||||
super<A>.f()
|
super<A>.f()
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@ open class A {
|
|||||||
open var test: Number = 10
|
open var test: Number = 10
|
||||||
}
|
}
|
||||||
|
|
||||||
open class B : A {
|
open class B : <!SUPERTYPE_NOT_INITIALIZED!>A<!> {
|
||||||
override var test: <!VAR_TYPE_MISMATCH_ON_OVERRIDE!>Double<!> = 20.0
|
override var test: <!VAR_TYPE_MISMATCH_ON_OVERRIDE!>Double<!> = 20.0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@ open class A {
|
|||||||
open fun test(): Number = 10
|
open fun test(): Number = 10
|
||||||
}
|
}
|
||||||
|
|
||||||
open class B : A {
|
open class B : <!SUPERTYPE_NOT_INITIALIZED!>A<!> {
|
||||||
override fun test(): Double = 20.0
|
override fun test(): Double = 20.0
|
||||||
fun test(x: Int) = x
|
fun test(x: Int) = x
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
class A
|
class A
|
||||||
class B : A
|
class B : <!SUPERTYPE_NOT_INITIALIZED!>A<!>
|
||||||
|
|
||||||
class C(x: Int)
|
class C(x: Int)
|
||||||
<!INAPPLICABLE_CANDIDATE!>class D : C<!>
|
<!INAPPLICABLE_CANDIDATE!>class D : <!SUPERTYPE_NOT_INITIALIZED!>C<!><!>
|
||||||
class E : C(10)
|
class E : C(10)
|
||||||
class F() : C(10)
|
class F() : C(10)
|
||||||
|
|
||||||
|
|||||||
Vendored
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
sealed class Base
|
sealed class Base
|
||||||
|
|
||||||
class A : Base
|
class A : <!SUPERTYPE_NOT_INITIALIZED!>Base<!>
|
||||||
|
|
||||||
// FILE: b.kt
|
// FILE: b.kt
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
class A
|
class A
|
||||||
open class B
|
open class B
|
||||||
class C : B
|
class C : <!SUPERTYPE_NOT_INITIALIZED!>B<!>
|
||||||
|
|
||||||
|
|
||||||
fun bar(a: A) = a
|
fun bar(a: A) = a
|
||||||
|
|||||||
+1
-1
@@ -14,6 +14,6 @@ public abstract class Decorator<T extends LookupElement> extends LookupElement {
|
|||||||
|
|
||||||
// FILE: test.kt
|
// FILE: test.kt
|
||||||
|
|
||||||
class MyDecorator : Decorator<LookupElement> {
|
class MyDecorator : <!SUPERTYPE_NOT_INITIALIZED!>Decorator<LookupElement><!> {
|
||||||
override fun getLookupString(): String = delegate.lookupString
|
override fun getLookupString(): String = delegate.lookupString
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -14,6 +14,6 @@ class A {
|
|||||||
<!VALUE_CLASS_CANNOT_BE_CLONEABLE!>inline<!> class CloneableClass2(val x: Int): java.lang.Cloneable
|
<!VALUE_CLASS_CANNOT_BE_CLONEABLE!>inline<!> class CloneableClass2(val x: Int): java.lang.Cloneable
|
||||||
|
|
||||||
open class Test
|
open class Test
|
||||||
inline class ExtendTest(val x: Int): <!INLINE_CLASS_CANNOT_EXTEND_CLASSES!>Test<!>
|
inline class ExtendTest(val x: Int): <!INLINE_CLASS_CANNOT_EXTEND_CLASSES, SUPERTYPE_NOT_INITIALIZED!>Test<!>
|
||||||
|
|
||||||
inline class ImplementByDelegation(val x: Int) : <!INLINE_CLASS_CANNOT_IMPLEMENT_INTERFACE_BY_DELEGATION!>Comparable<Int><!> by x
|
inline class ImplementByDelegation(val x: Int) : <!INLINE_CLASS_CANNOT_IMPLEMENT_INTERFACE_BY_DELEGATION!>Comparable<Int><!> by x
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ package test
|
|||||||
sealed class Test {
|
sealed class Test {
|
||||||
object O : Test()
|
object O : Test()
|
||||||
|
|
||||||
class Extra(val x: Int): Test
|
class Extra(val x: Int): <!SUPERTYPE_NOT_INITIALIZED!>Test<!>
|
||||||
}
|
}
|
||||||
|
|
||||||
// FILE: main.kt
|
// FILE: main.kt
|
||||||
|
|||||||
+3
-3
@@ -28,7 +28,7 @@ private class C {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class D : A {
|
class D : <!SUPERTYPE_NOT_INITIALIZED!>A<!> {
|
||||||
class Test1 : A.AProtectedI {
|
class Test1 : A.AProtectedI {
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -42,7 +42,7 @@ class Test2 : A.APublicI, <!UNRESOLVED_REFERENCE{LT}!><!UNRESOLVED_REFERENCE{PSI
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class Test3 : C.CPublicI, <!EXPOSED_SUPER_CLASS!>C<!> {
|
class Test3 : C.CPublicI, <!EXPOSED_SUPER_CLASS, SUPERTYPE_NOT_INITIALIZED!>C<!> {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,7 +54,7 @@ class Test5 : C.CPublicI, <!UNRESOLVED_REFERENCE{LT}!><!UNRESOLVED_REFERENCE{PSI
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class Test6 : E, <!EXPOSED_SUPER_CLASS!>C.CPublic<!> {
|
class Test6 : E, <!EXPOSED_SUPER_CLASS, SUPERTYPE_NOT_INITIALIZED!>C.CPublic<!> {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -23,7 +23,7 @@ internal class Test4<T: B>
|
|||||||
// valid, B is internal
|
// valid, B is internal
|
||||||
private class Test5<T: B>
|
private class Test5<T: B>
|
||||||
|
|
||||||
public class Container : C {
|
public class Container : <!SUPERTYPE_NOT_INITIALIZED!>C<!> {
|
||||||
// valid, D is protected in C
|
// valid, D is protected in C
|
||||||
protected class Test6<T: C.D>
|
protected class Test6<T: C.D>
|
||||||
|
|
||||||
|
|||||||
+5
-1
@@ -102,7 +102,7 @@ object DIAGNOSTICS_LIST : DiagnosticList() {
|
|||||||
val NON_PRIVATE_OR_PROTECTED_CONSTRUCTOR_IN_SEALED by error<FirSourceElement, PsiElement>()
|
val NON_PRIVATE_OR_PROTECTED_CONSTRUCTOR_IN_SEALED by error<FirSourceElement, PsiElement>()
|
||||||
val CYCLIC_CONSTRUCTOR_DELEGATION_CALL by warning<FirSourceElement, PsiElement>()
|
val CYCLIC_CONSTRUCTOR_DELEGATION_CALL by warning<FirSourceElement, PsiElement>()
|
||||||
val PRIMARY_CONSTRUCTOR_DELEGATION_CALL_EXPECTED by warning<FirSourceElement, PsiElement>(PositioningStrategy.SECONDARY_CONSTRUCTOR_DELEGATION_CALL)
|
val PRIMARY_CONSTRUCTOR_DELEGATION_CALL_EXPECTED by warning<FirSourceElement, PsiElement>(PositioningStrategy.SECONDARY_CONSTRUCTOR_DELEGATION_CALL)
|
||||||
val SUPERTYPE_INITIALIZED_WITHOUT_PRIMARY_CONSTRUCTOR by warning<FirSourceElement, PsiElement>()
|
val SUPERTYPE_INITIALIZED_WITHOUT_PRIMARY_CONSTRUCTOR by error<FirSourceElement, PsiElement>()
|
||||||
val DELEGATION_SUPER_CALL_IN_ENUM_CONSTRUCTOR by warning<FirSourceElement, PsiElement>()
|
val DELEGATION_SUPER_CALL_IN_ENUM_CONSTRUCTOR by warning<FirSourceElement, PsiElement>()
|
||||||
val PRIMARY_CONSTRUCTOR_REQUIRED_FOR_DATA_CLASS by error<FirSourceElement, KtNamedDeclaration>(PositioningStrategy.DECLARATION_NAME)
|
val PRIMARY_CONSTRUCTOR_REQUIRED_FOR_DATA_CLASS by error<FirSourceElement, KtNamedDeclaration>(PositioningStrategy.DECLARATION_NAME)
|
||||||
val EXPLICIT_DELEGATION_CALL_REQUIRED by warning<FirSourceElement, PsiElement>(PositioningStrategy.SECONDARY_CONSTRUCTOR_DELEGATION_CALL)
|
val EXPLICIT_DELEGATION_CALL_REQUIRED by warning<FirSourceElement, PsiElement>(PositioningStrategy.SECONDARY_CONSTRUCTOR_DELEGATION_CALL)
|
||||||
@@ -168,6 +168,10 @@ object DIAGNOSTICS_LIST : DiagnosticList() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val CLASSES_AND_INTERFACES by object : DiagnosticGroup("Classes and interfaces") {
|
||||||
|
val SUPERTYPE_NOT_INITIALIZED by error<FirSourceElement, KtSuperTypeEntry>()
|
||||||
|
}
|
||||||
|
|
||||||
val INLINE_CLASSES by object : DiagnosticGroup("Inline classes") {
|
val INLINE_CLASSES by object : DiagnosticGroup("Inline classes") {
|
||||||
val INLINE_CLASS_NOT_TOP_LEVEL by error<FirSourceElement, KtDeclaration>(PositioningStrategy.INLINE_OR_VALUE_MODIFIER)
|
val INLINE_CLASS_NOT_TOP_LEVEL by error<FirSourceElement, KtDeclaration>(PositioningStrategy.INLINE_OR_VALUE_MODIFIER)
|
||||||
val INLINE_CLASS_NOT_FINAL by error<FirSourceElement, KtDeclaration>(PositioningStrategy.MODALITY_MODIFIER)
|
val INLINE_CLASS_NOT_FINAL by error<FirSourceElement, KtDeclaration>(PositioningStrategy.MODALITY_MODIFIER)
|
||||||
|
|||||||
+5
-1
@@ -41,6 +41,7 @@ import org.jetbrains.kotlin.psi.KtProperty
|
|||||||
import org.jetbrains.kotlin.psi.KtPropertyAccessor
|
import org.jetbrains.kotlin.psi.KtPropertyAccessor
|
||||||
import org.jetbrains.kotlin.psi.KtPropertyDelegate
|
import org.jetbrains.kotlin.psi.KtPropertyDelegate
|
||||||
import org.jetbrains.kotlin.psi.KtSimpleNameExpression
|
import org.jetbrains.kotlin.psi.KtSimpleNameExpression
|
||||||
|
import org.jetbrains.kotlin.psi.KtSuperTypeEntry
|
||||||
import org.jetbrains.kotlin.psi.KtTypeParameter
|
import org.jetbrains.kotlin.psi.KtTypeParameter
|
||||||
import org.jetbrains.kotlin.psi.KtTypeParameterList
|
import org.jetbrains.kotlin.psi.KtTypeParameterList
|
||||||
import org.jetbrains.kotlin.psi.KtTypeReference
|
import org.jetbrains.kotlin.psi.KtTypeReference
|
||||||
@@ -105,7 +106,7 @@ object FirErrors {
|
|||||||
val NON_PRIVATE_OR_PROTECTED_CONSTRUCTOR_IN_SEALED by error0<FirSourceElement, PsiElement>()
|
val NON_PRIVATE_OR_PROTECTED_CONSTRUCTOR_IN_SEALED by error0<FirSourceElement, PsiElement>()
|
||||||
val CYCLIC_CONSTRUCTOR_DELEGATION_CALL by warning0<FirSourceElement, PsiElement>()
|
val CYCLIC_CONSTRUCTOR_DELEGATION_CALL by warning0<FirSourceElement, PsiElement>()
|
||||||
val PRIMARY_CONSTRUCTOR_DELEGATION_CALL_EXPECTED by warning0<FirSourceElement, PsiElement>(SourceElementPositioningStrategies.SECONDARY_CONSTRUCTOR_DELEGATION_CALL)
|
val PRIMARY_CONSTRUCTOR_DELEGATION_CALL_EXPECTED by warning0<FirSourceElement, PsiElement>(SourceElementPositioningStrategies.SECONDARY_CONSTRUCTOR_DELEGATION_CALL)
|
||||||
val SUPERTYPE_INITIALIZED_WITHOUT_PRIMARY_CONSTRUCTOR by warning0<FirSourceElement, PsiElement>()
|
val SUPERTYPE_INITIALIZED_WITHOUT_PRIMARY_CONSTRUCTOR by error0<FirSourceElement, PsiElement>()
|
||||||
val DELEGATION_SUPER_CALL_IN_ENUM_CONSTRUCTOR by warning0<FirSourceElement, PsiElement>()
|
val DELEGATION_SUPER_CALL_IN_ENUM_CONSTRUCTOR by warning0<FirSourceElement, PsiElement>()
|
||||||
val PRIMARY_CONSTRUCTOR_REQUIRED_FOR_DATA_CLASS by error0<FirSourceElement, KtNamedDeclaration>(SourceElementPositioningStrategies.DECLARATION_NAME)
|
val PRIMARY_CONSTRUCTOR_REQUIRED_FOR_DATA_CLASS by error0<FirSourceElement, KtNamedDeclaration>(SourceElementPositioningStrategies.DECLARATION_NAME)
|
||||||
val EXPLICIT_DELEGATION_CALL_REQUIRED by warning0<FirSourceElement, PsiElement>(SourceElementPositioningStrategies.SECONDARY_CONSTRUCTOR_DELEGATION_CALL)
|
val EXPLICIT_DELEGATION_CALL_REQUIRED by warning0<FirSourceElement, PsiElement>(SourceElementPositioningStrategies.SECONDARY_CONSTRUCTOR_DELEGATION_CALL)
|
||||||
@@ -149,6 +150,9 @@ object FirErrors {
|
|||||||
val REDUNDANT_OPEN_IN_INTERFACE by warning0<FirSourceElement, KtModifierListOwner>(SourceElementPositioningStrategies.OPEN_MODIFIER)
|
val REDUNDANT_OPEN_IN_INTERFACE by warning0<FirSourceElement, KtModifierListOwner>(SourceElementPositioningStrategies.OPEN_MODIFIER)
|
||||||
val WRONG_MODIFIER_TARGET by error2<FirSourceElement, PsiElement, KtModifierKeywordToken, String>()
|
val WRONG_MODIFIER_TARGET by error2<FirSourceElement, PsiElement, KtModifierKeywordToken, String>()
|
||||||
|
|
||||||
|
// Classes and interfaces
|
||||||
|
val SUPERTYPE_NOT_INITIALIZED by error0<FirSourceElement, KtSuperTypeEntry>()
|
||||||
|
|
||||||
// Inline classes
|
// Inline classes
|
||||||
val INLINE_CLASS_NOT_TOP_LEVEL by error0<FirSourceElement, KtDeclaration>(SourceElementPositioningStrategies.INLINE_OR_VALUE_MODIFIER)
|
val INLINE_CLASS_NOT_TOP_LEVEL by error0<FirSourceElement, KtDeclaration>(SourceElementPositioningStrategies.INLINE_OR_VALUE_MODIFIER)
|
||||||
val INLINE_CLASS_NOT_FINAL by error0<FirSourceElement, KtDeclaration>(SourceElementPositioningStrategies.MODALITY_MODIFIER)
|
val INLINE_CLASS_NOT_FINAL by error0<FirSourceElement, KtDeclaration>(SourceElementPositioningStrategies.MODALITY_MODIFIER)
|
||||||
|
|||||||
@@ -1,40 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
|
||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.jetbrains.kotlin.fir.analysis
|
|
||||||
|
|
||||||
import com.intellij.psi.tree.IElementType
|
|
||||||
import com.intellij.psi.tree.TokenSet
|
|
||||||
import org.jetbrains.kotlin.fir.*
|
|
||||||
|
|
||||||
fun FirSourceElement.getChild(type: IElementType, index: Int = 0, depth: Int = -1): FirSourceElement? {
|
|
||||||
return getChild(setOf(type), index, depth)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun FirSourceElement.getChild(types: TokenSet, index: Int = 0, depth: Int = -1): FirSourceElement? {
|
|
||||||
return getChild(types.types.toSet(), index, depth)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun FirSourceElement.getChild(types: Set<IElementType>, index: Int = 0, depth: Int = -1): FirSourceElement? {
|
|
||||||
return when (this) {
|
|
||||||
is FirPsiSourceElement<*> -> {
|
|
||||||
getChild(types, index, depth)
|
|
||||||
}
|
|
||||||
is FirLightSourceElement -> {
|
|
||||||
getChild(types, index, depth)
|
|
||||||
}
|
|
||||||
else -> null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun FirPsiSourceElement<*>.getChild(types: Set<IElementType>, index: Int, depth: Int): FirSourceElement? {
|
|
||||||
val visitor = PsiElementFinderByType(types, index, depth)
|
|
||||||
return visitor.find(psi)?.toFirPsiSourceElement()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun FirLightSourceElement.getChild(types: Set<IElementType>, index: Int, depth: Int): FirSourceElement? {
|
|
||||||
val visitor = LighterTreeElementFinderByType(treeStructure, types, index, depth)
|
|
||||||
return visitor.find(lighterASTNode)?.toFirLightSourceElement(treeStructure)
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,91 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.kotlin.fir.analysis
|
||||||
|
|
||||||
|
import com.intellij.lang.LighterASTNode
|
||||||
|
import com.intellij.psi.PsiElement
|
||||||
|
import com.intellij.psi.tree.IElementType
|
||||||
|
import com.intellij.psi.tree.TokenSet
|
||||||
|
import org.jetbrains.kotlin.fir.*
|
||||||
|
|
||||||
|
fun FirSourceElement.getChild(type: IElementType, index: Int = 0, depth: Int = -1): FirSourceElement? {
|
||||||
|
return getChild(setOf(type), index, depth)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun FirSourceElement.getChild(types: TokenSet, index: Int = 0, depth: Int = -1): FirSourceElement? {
|
||||||
|
return getChild(types.types.toSet(), index, depth)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun FirSourceElement.getChild(types: Set<IElementType>, index: Int = 0, depth: Int = -1): FirSourceElement? {
|
||||||
|
return when (this) {
|
||||||
|
is FirPsiSourceElement<*> -> {
|
||||||
|
getChild(types, index, depth)
|
||||||
|
}
|
||||||
|
is FirLightSourceElement -> {
|
||||||
|
getChild(types, index, depth)
|
||||||
|
}
|
||||||
|
else -> null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun FirPsiSourceElement<*>.getChild(types: Set<IElementType>, index: Int, depth: Int): FirSourceElement? {
|
||||||
|
val visitor = PsiElementFinderByType(types, index, depth)
|
||||||
|
return visitor.find(psi)?.toFirPsiSourceElement()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun FirLightSourceElement.getChild(types: Set<IElementType>, index: Int, depth: Int): FirSourceElement? {
|
||||||
|
val visitor = LighterTreeElementFinderByType(treeStructure, types, index, depth)
|
||||||
|
return visitor.find(lighterASTNode)?.let { withNode(it) }
|
||||||
|
}
|
||||||
|
|
||||||
|
fun FirSourceElement.getParent(type: IElementType, includingSelf: Boolean = false): FirSourceElement? {
|
||||||
|
return getParent(setOf(type), includingSelf)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun FirSourceElement.getParent(types: TokenSet, includingSelf: Boolean = false): FirSourceElement? {
|
||||||
|
return getParent(types.types.toSet(), includingSelf)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun FirSourceElement.getParent(types: Set<IElementType>, includingSelf: Boolean = false): FirSourceElement? {
|
||||||
|
return when (this) {
|
||||||
|
is FirPsiSourceElement<*> -> {
|
||||||
|
getParent(types, includingSelf)
|
||||||
|
}
|
||||||
|
is FirLightSourceElement -> {
|
||||||
|
getParent(types, includingSelf)
|
||||||
|
}
|
||||||
|
else -> null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun FirPsiSourceElement<*>.getParent(types: Set<IElementType>, includingSelf: Boolean): FirSourceElement? {
|
||||||
|
var parent: PsiElement? = if (includingSelf) psi else psi.parent
|
||||||
|
while (parent != null && parent.node.elementType !in types) {
|
||||||
|
parent = parent.parent
|
||||||
|
}
|
||||||
|
return parent?.toFirPsiSourceElement()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun FirLightSourceElement.getParent(types: Set<IElementType>, includingSelf: Boolean): FirSourceElement? {
|
||||||
|
var parent: LighterASTNode? = if (includingSelf) lighterASTNode else treeStructure.getParent(lighterASTNode)
|
||||||
|
while (parent != null && parent.tokenType !in types) {
|
||||||
|
parent = treeStructure.getParent(parent)
|
||||||
|
}
|
||||||
|
return parent?.let { withNode(it) }
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun FirLightSourceElement.withNode(newNode: LighterASTNode): FirLightSourceElement {
|
||||||
|
// It seems sometimes the `startOffset` from a `LighterASTNode` could count from some partial sub tree of the file. If this is the case,
|
||||||
|
// we need to compute the delta between the corresponding position in this partial tree and the file start. The latter can be retrieved
|
||||||
|
// from `FirLightSourceElement`.
|
||||||
|
val startDelta = this.startOffset - lighterASTNode.startOffset
|
||||||
|
val endDelta = this.endOffset - lighterASTNode.endOffset
|
||||||
|
return newNode.toFirLightSourceElement(
|
||||||
|
treeStructure,
|
||||||
|
startOffset = startDelta + newNode.startOffset,
|
||||||
|
endOffset = endDelta + newNode.endOffset
|
||||||
|
)
|
||||||
|
}
|
||||||
+100
@@ -0,0 +1,100 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.kotlin.fir.analysis.checkers.declaration
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.KtNodeTypes
|
||||||
|
import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
|
||||||
|
import org.jetbrains.kotlin.fir.analysis.checkers.toRegularClass
|
||||||
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter
|
||||||
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors
|
||||||
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.reportOn
|
||||||
|
import org.jetbrains.kotlin.fir.analysis.getParent
|
||||||
|
import org.jetbrains.kotlin.fir.declarations.FirConstructor
|
||||||
|
import org.jetbrains.kotlin.fir.declarations.FirRegularClass
|
||||||
|
import org.jetbrains.kotlin.fir.declarations.isInterface
|
||||||
|
import org.jetbrains.kotlin.fir.declarations.primaryConstructor
|
||||||
|
import org.jetbrains.kotlin.fir.types.coneType
|
||||||
|
import org.jetbrains.kotlin.fir.types.impl.FirImplicitAnyTypeRef
|
||||||
|
import org.jetbrains.kotlin.utils.addToStdlib.lastIsInstanceOrNull
|
||||||
|
|
||||||
|
/** Checker on super type declarations in the primary constructor of a class declaration. */
|
||||||
|
object FirPrimaryConstructorSuperTypeChecker : FirRegularClassChecker() {
|
||||||
|
override fun check(declaration: FirRegularClass, context: CheckerContext, reporter: DiagnosticReporter) {
|
||||||
|
if (declaration.isInterface) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
val primaryConstructor = declaration.primaryConstructor
|
||||||
|
|
||||||
|
if (primaryConstructor == null) {
|
||||||
|
checkSupertypeInitializedWithoutPrimaryConstructor(declaration, reporter, context)
|
||||||
|
} else {
|
||||||
|
checkSuperTypeNotInitialized(primaryConstructor, declaration, context, reporter)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SUPERTYPE_NOT_INITIALIZED is reported on code like the following. It's skipped if `A` has `()` after it, in which case any
|
||||||
|
* diagnostics for that constructor call will be reported, if applicable.
|
||||||
|
*
|
||||||
|
* ```
|
||||||
|
* open class A
|
||||||
|
* class B : <!SUPERTYPE_NOT_INITIALIZED>A<!>
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
private fun checkSuperTypeNotInitialized(
|
||||||
|
primaryConstructor: FirConstructor,
|
||||||
|
regularClass: FirRegularClass,
|
||||||
|
context: CheckerContext,
|
||||||
|
reporter: DiagnosticReporter
|
||||||
|
) {
|
||||||
|
val containingClass = context.containingDeclarations.lastIsInstanceOrNull<FirRegularClass>()
|
||||||
|
val delegatedConstructorCall = primaryConstructor.delegatedConstructor ?: return
|
||||||
|
// No need to check implicit call to the constructor of `kotlin.Any`.
|
||||||
|
if (delegatedConstructorCall.constructedTypeRef is FirImplicitAnyTypeRef) return
|
||||||
|
val superClass = delegatedConstructorCall.constructedTypeRef.coneType.toRegularClass(context.session) ?: return
|
||||||
|
// Subclassing a singleton should be reported as SINGLETON_IN_SUPERTYPE
|
||||||
|
if (superClass.classKind.isSingleton) return
|
||||||
|
if (regularClass.isEffectivelyExpect(containingClass, context) ||
|
||||||
|
regularClass.isEffectivelyExternal(containingClass, context)
|
||||||
|
) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (delegatedConstructorCall.source?.elementType != KtNodeTypes.SUPER_TYPE_CALL_ENTRY) {
|
||||||
|
reporter.reportOn(
|
||||||
|
delegatedConstructorCall.constructedTypeRef.source?.getParent(KtNodeTypes.SUPER_TYPE_ENTRY),
|
||||||
|
FirErrors.SUPERTYPE_NOT_INITIALIZED,
|
||||||
|
context
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SUPERTYPE_INITIALIZED_WITHOUT_PRIMARY_CONSTRUCTOR is reported on code like the following, where `B` does not have a primary
|
||||||
|
* constructor, in which case, one can not call the delegated constructor of `A` in the super type list. `B` doesn't have a primary
|
||||||
|
* constructor because it doesn't declare it, nor is it implicitly created in presence of a explicitly declared constructor inside the
|
||||||
|
* class body.
|
||||||
|
*
|
||||||
|
* ```
|
||||||
|
* open class A
|
||||||
|
* class B : <!SUPERTYPE_INITIALIZED_WITHOUT_PRIMARY_CONSTRUCTOR>A()<!> {
|
||||||
|
* constructor()
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
private fun checkSupertypeInitializedWithoutPrimaryConstructor(
|
||||||
|
regularClass: FirRegularClass,
|
||||||
|
reporter: DiagnosticReporter,
|
||||||
|
context: CheckerContext
|
||||||
|
) {
|
||||||
|
for (superTypeRef in regularClass.superTypeRefs) {
|
||||||
|
val source = superTypeRef.source ?: continue
|
||||||
|
if (source.treeStructure.getParent(source.lighterASTNode)?.tokenType == KtNodeTypes.CONSTRUCTOR_CALLEE) {
|
||||||
|
reporter.reportOn(regularClass.source, FirErrors.SUPERTYPE_INITIALIZED_WITHOUT_PRIMARY_CONSTRUCTOR, context)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
-34
@@ -1,34 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
|
||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.jetbrains.kotlin.fir.analysis.checkers.declaration
|
|
||||||
|
|
||||||
import org.jetbrains.kotlin.KtNodeTypes
|
|
||||||
import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
|
|
||||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter
|
|
||||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors
|
|
||||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.reportOn
|
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirConstructor
|
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirRegularClass
|
|
||||||
import org.jetbrains.kotlin.fir.declarations.isInterface
|
|
||||||
|
|
||||||
object FirSupertypeInitializedWithoutPrimaryConstructor : FirRegularClassChecker() {
|
|
||||||
override fun check(declaration: FirRegularClass, context: CheckerContext, reporter: DiagnosticReporter) {
|
|
||||||
if (declaration.isInterface) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (declaration.declarations.any { it is FirConstructor && it.isPrimary }) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
for (superTypeRef in declaration.superTypeRefs) {
|
|
||||||
val source = superTypeRef.source ?: continue
|
|
||||||
if (source.treeStructure.getParent(source.lighterASTNode)?.tokenType == KtNodeTypes.CONSTRUCTOR_CALLEE) {
|
|
||||||
reporter.reportOn(declaration.source, FirErrors.SUPERTYPE_INITIALIZED_WITHOUT_PRIMARY_CONSTRUCTOR, context)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+4
@@ -184,6 +184,7 @@ import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.SUPERCLASS_NOT_AC
|
|||||||
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_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.SUPER_IS_NOT_AN_EXPRESSION
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.SUPER_IS_NOT_AN_EXPRESSION
|
||||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.SUPER_NOT_AVAILABLE
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.SUPER_NOT_AVAILABLE
|
||||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.SYNTAX
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.SYNTAX
|
||||||
@@ -365,6 +366,9 @@ class FirDefaultErrorMessages : DefaultErrorMessages.Extension {
|
|||||||
map.put(REDUNDANT_OPEN_IN_INTERFACE, "Modifier 'open' is redundant for abstract interface members")
|
map.put(REDUNDANT_OPEN_IN_INTERFACE, "Modifier 'open' is redundant for abstract interface members")
|
||||||
map.put(WRONG_MODIFIER_TARGET, "Modifier ''{0}'' is not applicable to ''{1}''", TO_STRING, TO_STRING)
|
map.put(WRONG_MODIFIER_TARGET, "Modifier ''{0}'' is not applicable to ''{1}''", TO_STRING, TO_STRING)
|
||||||
|
|
||||||
|
// Classes and interfaces
|
||||||
|
map.put(SUPERTYPE_NOT_INITIALIZED, "This type has a constructor, and thus must be initialized here")
|
||||||
|
|
||||||
// Applicability
|
// Applicability
|
||||||
map.put(NONE_APPLICABLE, "None of the following functions are applicable: {0}", SYMBOLS)
|
map.put(NONE_APPLICABLE, "None of the following functions are applicable: {0}", SYMBOLS)
|
||||||
map.put(INAPPLICABLE_CANDIDATE, "Inapplicable candidate(s): {0}", SYMBOL)
|
map.put(INAPPLICABLE_CANDIDATE, "Inapplicable candidate(s): {0}", SYMBOL)
|
||||||
|
|||||||
+1
-1
@@ -58,7 +58,7 @@ object CommonDeclarationCheckers : DeclarationCheckers() {
|
|||||||
FirMethodOfAnyImplementedInInterfaceChecker,
|
FirMethodOfAnyImplementedInInterfaceChecker,
|
||||||
FirDataClassPrimaryConstructorChecker,
|
FirDataClassPrimaryConstructorChecker,
|
||||||
FirSupertypeInitializedInInterfaceChecker,
|
FirSupertypeInitializedInInterfaceChecker,
|
||||||
FirSupertypeInitializedWithoutPrimaryConstructor,
|
FirPrimaryConstructorSuperTypeChecker,
|
||||||
FirTypeParametersInObjectChecker,
|
FirTypeParametersInObjectChecker,
|
||||||
FirMemberFunctionsChecker,
|
FirMemberFunctionsChecker,
|
||||||
FirMemberPropertiesChecker,
|
FirMemberPropertiesChecker,
|
||||||
|
|||||||
+5
-5
@@ -1,11 +1,11 @@
|
|||||||
open class NoC
|
open class NoC
|
||||||
class NoC1 : NoC
|
class NoC1 : <!SUPERTYPE_NOT_INITIALIZED!>NoC<!>
|
||||||
|
|
||||||
class WithC0() : NoC()
|
class WithC0() : NoC()
|
||||||
open class WithC1() : NoC
|
open class WithC1() : <!SUPERTYPE_NOT_INITIALIZED!>NoC<!>
|
||||||
class NoC2 : WithC1
|
class NoC2 : <!SUPERTYPE_NOT_INITIALIZED!>WithC1<!>
|
||||||
class NoC3 : WithC1()
|
class NoC3 : WithC1()
|
||||||
class WithC2() : WithC1
|
class WithC2() : <!SUPERTYPE_NOT_INITIALIZED!>WithC1<!>
|
||||||
|
|
||||||
class WithPC0() {
|
class WithPC0() {
|
||||||
}
|
}
|
||||||
@@ -32,4 +32,4 @@ class NoCPI {
|
|||||||
var ab = <!PROPERTY_INITIALIZER_NO_BACKING_FIELD!>1<!>
|
var ab = <!PROPERTY_INITIALIZER_NO_BACKING_FIELD!>1<!>
|
||||||
get() = 1
|
get() = 1
|
||||||
set(v) {}
|
set(v) {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,12 +38,12 @@ interface Test6 : <!INTERFACE_WITH_SUPERCLASS!>C1<!> {}
|
|||||||
|
|
||||||
class CTest1() : OC1() {}
|
class CTest1() : OC1() {}
|
||||||
|
|
||||||
class CTest2 : C2 {}
|
class CTest2 : <!SUPERTYPE_NOT_INITIALIZED!>C2<!> {}
|
||||||
|
|
||||||
class CTest3 : C2, C3 {}
|
class CTest3 : <!SUPERTYPE_NOT_INITIALIZED!>C2<!>, C3 {}
|
||||||
|
|
||||||
class CTest4 : T1 {}
|
class CTest4 : T1 {}
|
||||||
|
|
||||||
class CTest5 : T1, T1 {}
|
class CTest5 : T1, T1 {}
|
||||||
|
|
||||||
class CTest6 : C1 {}
|
class CTest6 : <!SUPERTYPE_NOT_INITIALIZED!>C1<!> {}
|
||||||
|
|||||||
+2
-2
@@ -10,10 +10,10 @@ package test.p; class C {fun f() {}}
|
|||||||
package test.p; open class G<T> {open fun f(): T {} fun a() {}}
|
package test.p; open class G<T> {open fun f(): T {} fun a() {}}
|
||||||
|
|
||||||
// FILE: d.kt
|
// FILE: d.kt
|
||||||
package test.p; class G2<E> : G<E> { fun g() : E {} override fun f() : E {}}
|
package test.p; class G2<E> : <!SUPERTYPE_NOT_INITIALIZED!>G<E><!> { fun g() : E {} override fun f() : E {}}
|
||||||
|
|
||||||
// FILE: e.kt
|
// FILE: e.kt
|
||||||
package test.p; fun foo() {}
|
package test.p; fun foo() {}
|
||||||
|
|
||||||
// FILE: f.kt
|
// FILE: f.kt
|
||||||
package test.p; fun foo(a: C) {}
|
package test.p; fun foo(a: C) {}
|
||||||
|
|||||||
+1
-1
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
expect open class A
|
expect open class A
|
||||||
expect class B : A
|
expect class B : A
|
||||||
open class C : A
|
open class C : <!SUPERTYPE_NOT_INITIALIZED!>A<!>
|
||||||
|
|
||||||
// MODULE: m1-jvm(m1-common)
|
// MODULE: m1-jvm(m1-common)
|
||||||
// FILE: jvm.kt
|
// FILE: jvm.kt
|
||||||
|
|||||||
@@ -15,4 +15,4 @@ actual typealias Presence = P
|
|||||||
sealed class P {
|
sealed class P {
|
||||||
object Online : P()
|
object Online : P()
|
||||||
object Offline : P()
|
object Offline : P()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ package toplevelObjectDeclarations
|
|||||||
open fun foo() : Int = 1
|
open fun foo() : Int = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
<!INAPPLICABLE_CANDIDATE!>class T : Foo {}<!>
|
<!INAPPLICABLE_CANDIDATE!>class T : <!SUPERTYPE_NOT_INITIALIZED!>Foo<!> {}<!>
|
||||||
|
|
||||||
<!INAPPLICABLE_CANDIDATE!>object A : Foo {
|
<!INAPPLICABLE_CANDIDATE!>object A : <!SUPERTYPE_NOT_INITIALIZED!>Foo<!> {
|
||||||
val x : Int = 2
|
val x : Int = 2
|
||||||
|
|
||||||
fun test() : Int {
|
fun test() : Int {
|
||||||
|
|||||||
+7
@@ -32,6 +32,7 @@ import org.jetbrains.kotlin.psi.KtProperty
|
|||||||
import org.jetbrains.kotlin.psi.KtPropertyAccessor
|
import org.jetbrains.kotlin.psi.KtPropertyAccessor
|
||||||
import org.jetbrains.kotlin.psi.KtPropertyDelegate
|
import org.jetbrains.kotlin.psi.KtPropertyDelegate
|
||||||
import org.jetbrains.kotlin.psi.KtSimpleNameExpression
|
import org.jetbrains.kotlin.psi.KtSimpleNameExpression
|
||||||
|
import org.jetbrains.kotlin.psi.KtSuperTypeEntry
|
||||||
import org.jetbrains.kotlin.psi.KtTypeParameter
|
import org.jetbrains.kotlin.psi.KtTypeParameter
|
||||||
import org.jetbrains.kotlin.psi.KtTypeParameterList
|
import org.jetbrains.kotlin.psi.KtTypeParameterList
|
||||||
import org.jetbrains.kotlin.psi.KtTypeReference
|
import org.jetbrains.kotlin.psi.KtTypeReference
|
||||||
@@ -554,6 +555,12 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert
|
|||||||
token,
|
token,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
add(FirErrors.SUPERTYPE_NOT_INITIALIZED) { firDiagnostic ->
|
||||||
|
SupertypeNotInitializedImpl(
|
||||||
|
firDiagnostic as FirPsiDiagnostic<*>,
|
||||||
|
token,
|
||||||
|
)
|
||||||
|
}
|
||||||
add(FirErrors.INLINE_CLASS_NOT_TOP_LEVEL) { firDiagnostic ->
|
add(FirErrors.INLINE_CLASS_NOT_TOP_LEVEL) { firDiagnostic ->
|
||||||
InlineClassNotTopLevelImpl(
|
InlineClassNotTopLevelImpl(
|
||||||
firDiagnostic as FirPsiDiagnostic<*>,
|
firDiagnostic as FirPsiDiagnostic<*>,
|
||||||
|
|||||||
+5
@@ -36,6 +36,7 @@ import org.jetbrains.kotlin.psi.KtProperty
|
|||||||
import org.jetbrains.kotlin.psi.KtPropertyAccessor
|
import org.jetbrains.kotlin.psi.KtPropertyAccessor
|
||||||
import org.jetbrains.kotlin.psi.KtPropertyDelegate
|
import org.jetbrains.kotlin.psi.KtPropertyDelegate
|
||||||
import org.jetbrains.kotlin.psi.KtSimpleNameExpression
|
import org.jetbrains.kotlin.psi.KtSimpleNameExpression
|
||||||
|
import org.jetbrains.kotlin.psi.KtSuperTypeEntry
|
||||||
import org.jetbrains.kotlin.psi.KtTypeParameter
|
import org.jetbrains.kotlin.psi.KtTypeParameter
|
||||||
import org.jetbrains.kotlin.psi.KtTypeParameterList
|
import org.jetbrains.kotlin.psi.KtTypeParameterList
|
||||||
import org.jetbrains.kotlin.psi.KtTypeReference
|
import org.jetbrains.kotlin.psi.KtTypeReference
|
||||||
@@ -403,6 +404,10 @@ sealed class KtFirDiagnostic<PSI: PsiElement> : KtDiagnosticWithPsi<PSI> {
|
|||||||
abstract val target: String
|
abstract val target: String
|
||||||
}
|
}
|
||||||
|
|
||||||
|
abstract class SupertypeNotInitialized : KtFirDiagnostic<KtSuperTypeEntry>() {
|
||||||
|
override val diagnosticClass get() = SupertypeNotInitialized::class
|
||||||
|
}
|
||||||
|
|
||||||
abstract class InlineClassNotTopLevel : KtFirDiagnostic<KtDeclaration>() {
|
abstract class InlineClassNotTopLevel : KtFirDiagnostic<KtDeclaration>() {
|
||||||
override val diagnosticClass get() = InlineClassNotTopLevel::class
|
override val diagnosticClass get() = InlineClassNotTopLevel::class
|
||||||
}
|
}
|
||||||
|
|||||||
+8
@@ -38,6 +38,7 @@ import org.jetbrains.kotlin.psi.KtProperty
|
|||||||
import org.jetbrains.kotlin.psi.KtPropertyAccessor
|
import org.jetbrains.kotlin.psi.KtPropertyAccessor
|
||||||
import org.jetbrains.kotlin.psi.KtPropertyDelegate
|
import org.jetbrains.kotlin.psi.KtPropertyDelegate
|
||||||
import org.jetbrains.kotlin.psi.KtSimpleNameExpression
|
import org.jetbrains.kotlin.psi.KtSimpleNameExpression
|
||||||
|
import org.jetbrains.kotlin.psi.KtSuperTypeEntry
|
||||||
import org.jetbrains.kotlin.psi.KtTypeParameter
|
import org.jetbrains.kotlin.psi.KtTypeParameter
|
||||||
import org.jetbrains.kotlin.psi.KtTypeParameterList
|
import org.jetbrains.kotlin.psi.KtTypeParameterList
|
||||||
import org.jetbrains.kotlin.psi.KtTypeReference
|
import org.jetbrains.kotlin.psi.KtTypeReference
|
||||||
@@ -638,6 +639,13 @@ internal class WrongModifierTargetImpl(
|
|||||||
override val firDiagnostic: FirPsiDiagnostic<*> by weakRef(firDiagnostic)
|
override val firDiagnostic: FirPsiDiagnostic<*> by weakRef(firDiagnostic)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal class SupertypeNotInitializedImpl(
|
||||||
|
firDiagnostic: FirPsiDiagnostic<*>,
|
||||||
|
override val token: ValidityToken,
|
||||||
|
) : KtFirDiagnostic.SupertypeNotInitialized(), KtAbstractFirDiagnostic<KtSuperTypeEntry> {
|
||||||
|
override val firDiagnostic: FirPsiDiagnostic<*> by weakRef(firDiagnostic)
|
||||||
|
}
|
||||||
|
|
||||||
internal class InlineClassNotTopLevelImpl(
|
internal class InlineClassNotTopLevelImpl(
|
||||||
firDiagnostic: FirPsiDiagnostic<*>,
|
firDiagnostic: FirPsiDiagnostic<*>,
|
||||||
override val token: ValidityToken,
|
override val token: ValidityToken,
|
||||||
|
|||||||
Reference in New Issue
Block a user