[FIR] Introduce TYPE_ARGUMENTS_NOT_ALLOWED & some other type errors

This commit introduces several different things, in particular:
- check type arguments in expressions
- new TypeArgumentList node to deal with diagnostic source
- ConeDiagnostic was moved to fir:cones
- ConeIntermediateDiagnostic to use in inference (?) without reporting
- detailed diagnostics on error type
This commit is contained in:
Mikhail Glukhikh
2020-07-22 10:29:59 +03:00
parent c744dfba9c
commit 0804c6a0f3
196 changed files with 774 additions and 484 deletions
@@ -8,6 +8,6 @@ open class Base {
class Derived : Base() {
@Foo
@<!OTHER_ERROR!>Foo<!>
fun foo() = 42
}
@@ -72,28 +72,28 @@ class C : O.B() {
val n: FromCompanionC? = null
// INVISIBLE: direct superclasses themselves.
val a: A? = null
val b: B? = null
val a: <!OTHER_ERROR, OTHER_ERROR!>A?<!> = null
val b: <!OTHER_ERROR, OTHER_ERROR!>B?<!> = null
// DEPRECATED: Classifiers from companions of direct superclasses
val e: FromCompanionA? = null
val f: FromCompanionB? = null
val e: <!OTHER_ERROR, OTHER_ERROR!>FromCompanionA?<!> = null
val f: <!OTHER_ERROR, OTHER_ERROR!>FromCompanionB?<!> = null
// INVISIBLE: "cousin" supertypes themselves
val g: Alpha? = null
val h: Beta? = null
val i: Gamma? = null
val g: <!OTHER_ERROR, OTHER_ERROR!>Alpha?<!> = null
val h: <!OTHER_ERROR, OTHER_ERROR!>Beta?<!> = null
val i: <!OTHER_ERROR, OTHER_ERROR!>Gamma?<!> = null
// DEPRECATED: classifiers from "cousin" superclasses
val k: FromAlpha? = null
val l: FromBeta? = null
val m: FromGamma? = null
val k: <!OTHER_ERROR, OTHER_ERROR!>FromAlpha?<!> = null
val l: <!OTHER_ERROR, OTHER_ERROR!>FromBeta?<!> = null
val m: <!OTHER_ERROR, OTHER_ERROR!>FromGamma?<!> = null
// INVISIBLE: We don't see classifiers from companions of "cousin" superclasses
val o: FromCompanionAlpha? = null
val p: FromCompanionBeta? = null
val q: FromCompanionGamma? = null
val o: <!OTHER_ERROR, OTHER_ERROR!>FromCompanionAlpha?<!> = null
val p: <!OTHER_ERROR, OTHER_ERROR!>FromCompanionBeta?<!> = null
val q: <!OTHER_ERROR, OTHER_ERROR!>FromCompanionGamma?<!> = null
// DEPRECATED: Classifiers from supertypes of our own companion
val r: FromDelta? = null
val r: <!OTHER_ERROR, OTHER_ERROR!>FromDelta?<!> = null
}
@@ -71,28 +71,28 @@ class C : O.B() {
val n: FromCompanionC? = null
// INVISIBLE: direct superclasses themselves.
val a: A? = null
val b: B? = null
val a: <!OTHER_ERROR, OTHER_ERROR!>A?<!> = null
val b: <!OTHER_ERROR, OTHER_ERROR!>B?<!> = null
// DEPRECATED: Classifiers from companions of direct superclasses
val e: FromCompanionA? = null
val f: FromCompanionB? = null
val e: <!OTHER_ERROR, OTHER_ERROR!>FromCompanionA?<!> = null
val f: <!OTHER_ERROR, OTHER_ERROR!>FromCompanionB?<!> = null
// INVISIBLE: "cousin" supertypes themselves
val g: Alpha? = null
val h: Beta? = null
val i: Gamma? = null
val g: <!OTHER_ERROR, OTHER_ERROR!>Alpha?<!> = null
val h: <!OTHER_ERROR, OTHER_ERROR!>Beta?<!> = null
val i: <!OTHER_ERROR, OTHER_ERROR!>Gamma?<!> = null
// DEPRECATED: classifiers from "cousin" superclasses
val k: FromAlpha? = null
val l: FromBeta? = null
val m: FromGamma? = null
val k: <!OTHER_ERROR, OTHER_ERROR!>FromAlpha?<!> = null
val l: <!OTHER_ERROR, OTHER_ERROR!>FromBeta?<!> = null
val m: <!OTHER_ERROR, OTHER_ERROR!>FromGamma?<!> = null
// INVISIBLE: We don't see classifiers from companions of "cousin" superclasses
val o: FromCompanionAlpha? = null
val p: FromCompanionBeta? = null
val q: FromCompanionGamma? = null
val o: <!OTHER_ERROR, OTHER_ERROR!>FromCompanionAlpha?<!> = null
val p: <!OTHER_ERROR, OTHER_ERROR!>FromCompanionBeta?<!> = null
val q: <!OTHER_ERROR, OTHER_ERROR!>FromCompanionGamma?<!> = null
// DEPRECATED: Classifiers from supertypes of our own companion
val r: FromDelta? = null
val r: <!OTHER_ERROR, OTHER_ERROR!>FromDelta?<!> = null
}
@@ -73,28 +73,28 @@ open class C : O.B() {
open class n : FromCompanionC()
// INVISIBLE: direct superclasses themselves.
open class a : A()
open class b : B()
open class a : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>A<!>()
open class b : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>B<!>()
// DEPRECATED: Classifiers from companions of direct superclasses
open class e : FromCompanionA()
open class f : FromCompanionB()
open class e : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>FromCompanionA<!>()
open class f : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>FromCompanionB<!>()
// INVISIBLE: "cousin" supertypes themselves
open class g : Alpha()
open class h : Beta()
open class i : Gamma()
open class g : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>Alpha<!>()
open class h : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>Beta<!>()
open class i : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>Gamma<!>()
// DEPRECATED: classifiers from "cousin" superclasses
open class k : FromAlpha()
open class l : FromBeta()
open class m : FromGamma()
open class k : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>FromAlpha<!>()
open class l : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>FromBeta<!>()
open class m : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>FromGamma<!>()
// INVISIBLE: We don't see classifiers from companions of "cousin" superclasses
open class o : FromCompanionAlpha()
open class p : FromCompanionBeta()
open class q : FromCompanionGamma()
open class o : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>FromCompanionAlpha<!>()
open class p : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>FromCompanionBeta<!>()
open class q : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>FromCompanionGamma<!>()
// DEPRECATED: Classifiers from supertypes of our own companion
open class r : FromDelta()
open class r : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>FromDelta<!>()
}
@@ -73,28 +73,28 @@ open class C : O.B() {
open class n : FromCompanionC()
// INVISIBLE: direct superclasses themselves.
open class a : A()
open class b : B()
open class a : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>A<!>()
open class b : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>B<!>()
// DEPRECATED: Classifiers from companions of direct superclasses
open class e : FromCompanionA()
open class f : FromCompanionB()
open class e : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>FromCompanionA<!>()
open class f : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>FromCompanionB<!>()
// INVISIBLE: "cousin" supertypes themselves
open class g : Alpha()
open class h : Beta()
open class i : Gamma()
open class g : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>Alpha<!>()
open class h : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>Beta<!>()
open class i : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>Gamma<!>()
// DEPRECATED: classifiers from "cousin" superclasses
open class k : FromAlpha()
open class l : FromBeta()
open class m : FromGamma()
open class k : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>FromAlpha<!>()
open class l : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>FromBeta<!>()
open class m : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>FromGamma<!>()
// INVISIBLE: We don't see classifiers from companions of "cousin" superclasses
open class o : FromCompanionAlpha()
open class p : FromCompanionBeta()
open class q : FromCompanionGamma()
open class o : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>FromCompanionAlpha<!>()
open class p : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>FromCompanionBeta<!>()
open class q : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>FromCompanionGamma<!>()
// DEPRECATED: Classifiers from supertypes of our own companion
open class r : FromDelta()
open class r : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>FromDelta<!>()
}
@@ -27,7 +27,7 @@ open class Base {
}
class Derived : Base() {
fun test(javaStaticInTypePosition: Classifier) {
fun test(javaStaticInTypePosition: <!OTHER_ERROR!>Classifier<!>) {
<!UNRESOLVED_REFERENCE!>method<!>()
<!UNRESOLVED_REFERENCE!>property<!>
<!UNRESOLVED_REFERENCE!>Classifier<!>()
@@ -42,7 +42,7 @@ class Derived : Base() {
<!UNRESOLVED_REFERENCE!>syntheticProperty<!> = 42
}
class JavaStaticInSupertypeList : Classifier() {
class JavaStaticInSupertypeList : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>Classifier<!>() {
}
}
@@ -27,7 +27,7 @@ open class Base {
}
class Derived : Base() {
fun test(javaStaticInTypePosition: Classifier) {
fun test(javaStaticInTypePosition: <!OTHER_ERROR!>Classifier<!>) {
<!UNRESOLVED_REFERENCE!>method<!>()
<!UNRESOLVED_REFERENCE!>property<!>
<!UNRESOLVED_REFERENCE!>Classifier<!>()
@@ -42,7 +42,7 @@ class Derived : Base() {
<!UNRESOLVED_REFERENCE!>syntheticProperty<!> = 42
}
class JavaStaticInSupertypeList : Classifier() {
class JavaStaticInSupertypeList : <!OTHER_ERROR, OTHER_ERROR, OTHER_ERROR!>Classifier<!>() {
}
}