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:
Tianyu Geng
2021-03-09 15:25:05 -08:00
committed by Dmitriy Novozhilov
parent 6134c00698
commit 56bec6997c
30 changed files with 256 additions and 107 deletions
@@ -21,7 +21,7 @@ class LinkedList<T> : java.util.LinkedList<T>()
package util
class HashSet<T> : java.util.HashSet<T>
class HashSet<T> : <!SUPERTYPE_NOT_INITIALIZED!>java.util.HashSet<T><!>
// FILE: main.kt
@@ -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!>fun rest(s: String)<!> {}
@@ -2,7 +2,7 @@ class A {
fun f() {}
}
class B : A {
class B : <!SUPERTYPE_NOT_INITIALIZED!>A<!> {
fun g() {
<!NOT_A_SUPERTYPE!>super<String><!>.<!UNRESOLVED_REFERENCE!>f<!>()
super<A>.f()
@@ -2,7 +2,7 @@ open class A {
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
}
@@ -2,7 +2,7 @@ open class A {
open fun test(): Number = 10
}
open class B : A {
open class B : <!SUPERTYPE_NOT_INITIALIZED!>A<!> {
override fun test(): Double = 20.0
fun test(x: Int) = x
}
@@ -1,8 +1,8 @@
class A
class B : A
class B : <!SUPERTYPE_NOT_INITIALIZED!>A<!>
class C(x: Int)
<!INAPPLICABLE_CANDIDATE!>class D : C<!>
<!INAPPLICABLE_CANDIDATE!>class D : <!SUPERTYPE_NOT_INITIALIZED!>C<!><!>
class E : C(10)
class F() : C(10)
@@ -2,7 +2,7 @@
sealed class Base
class A : Base
class A : <!SUPERTYPE_NOT_INITIALIZED!>Base<!>
// FILE: b.kt
@@ -1,6 +1,6 @@
class A
open class B
class C : B
class C : <!SUPERTYPE_NOT_INITIALIZED!>B<!>
fun bar(a: A) = a
@@ -14,6 +14,6 @@ public abstract class Decorator<T extends LookupElement> extends LookupElement {
// FILE: test.kt
class MyDecorator : Decorator<LookupElement> {
class MyDecorator : <!SUPERTYPE_NOT_INITIALIZED!>Decorator<LookupElement><!> {
override fun getLookupString(): String = delegate.lookupString
}
@@ -14,6 +14,6 @@ class A {
<!VALUE_CLASS_CANNOT_BE_CLONEABLE!>inline<!> class CloneableClass2(val x: Int): java.lang.Cloneable
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
@@ -5,7 +5,7 @@ package test
sealed class Test {
object O : Test()
class Extra(val x: Int): Test
class Extra(val x: Int): <!SUPERTYPE_NOT_INITIALIZED!>Test<!>
}
// FILE: main.kt
@@ -28,7 +28,7 @@ private class C {
}
}
class D : A {
class D : <!SUPERTYPE_NOT_INITIALIZED!>A<!> {
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<!> {
}
@@ -23,7 +23,7 @@ internal class Test4<T: B>
// valid, B is internal
private class Test5<T: B>
public class Container : C {
public class Container : <!SUPERTYPE_NOT_INITIALIZED!>C<!> {
// valid, D is protected in C
protected class Test6<T: C.D>