[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
@@ -15,7 +15,7 @@ class A {
// Does not work, could be Outer<String>.Inner<Int>
// TODO: Should work?
fun foo(x: Inner<Int>) {
fun foo(x: <!OTHER_ERROR!>Inner<Int><!>) {
// Inner<Char>() call use companion as implicit receiver
val y: Outer<String>.Inner<Char> = Inner<Char>()
}
@@ -15,7 +15,7 @@ class A {
// Does not work, could be Outer<String>.Inner<Int>
// TODO: Should work?
fun foo(x: Inner<Int>) {
fun foo(x: <!OTHER_ERROR!>Inner<Int><!>) {
// Inner<Char>() call use companion as implicit receiver
val y: Outer<String>.Inner<Char> = Inner<Char>()
}
@@ -7,14 +7,14 @@ open class Outer<X, Y> {
class Derived : Outer<String, Int>() {
fun foo(): Inner<Char> = null!!
fun baz(): Alias<Char> = null!!
fun baz(): <!OTHER_ERROR, OTHER_ERROR!>Alias<Char><!> = null!!
}
class A : Outer<Double, Short>() {
class B : Outer<Float, Long>() {
fun bar(): Inner<String> = null!!
fun x(): Alias<String> = null!!
fun x(): <!OTHER_ERROR, OTHER_ERROR!>Alias<String><!> = null!!
}
}
@@ -10,12 +10,12 @@ private fun <E> foobar() = {
fun a() = A<E, X, Y, Z>()
}
typealias LocalAlias<W> = A<E, X, Y, W>
typealias LocalAlias<W> = <!OTHER_ERROR!>A<E, X, Y, W><!>
}
class Derived : LocalOuter<Double, Short>() {
fun foo(): LocalInner<Long> = null!!
fun bar(): LocalAlias<Char> = null!!
fun bar(): <!OTHER_ERROR, OTHER_ERROR!>LocalAlias<Char><!> = null!!
}
Derived()
@@ -27,12 +27,12 @@ private fun noParameters() = {
fun a() = A<Any, X, Y, Z>()
}
typealias LocalAlias2<W> = A<Any, X, Y, W>
typealias LocalAlias2<W> = <!OTHER_ERROR!>A<Any, X, Y, W><!>
}
class Derived2 : LocalOuter2<Double, Short>() {
fun foo(): LocalInner2<Long> = null!!
fun bar(): LocalAlias2<Char> = null!!
fun bar(): <!OTHER_ERROR, OTHER_ERROR!>LocalAlias2<Char><!> = null!!
}
Derived2()
@@ -12,12 +12,12 @@ class Outer<T> {
fun a() = A<T, F, E, X, Y, Z>()
}
typealias LocalAlias<W> = A<T, F, E, X, Y, W>
typealias LocalAlias<W> = <!OTHER_ERROR!>A<T, F, E, X, Y, W><!>
}
class Derived : LocalOuter<Double, Short>() {
fun foo(): LocalInner<Long> = null!!
fun bar(): LocalAlias<Char> = null!!
fun bar(): <!OTHER_ERROR, OTHER_ERROR!>LocalAlias<Char><!> = null!!
}
Derived()
@@ -29,12 +29,12 @@ class Outer<T> {
fun a() = A<T, F, Any, X, Y, Z>()
}
typealias LocalAlias2<W> = A<T, F, Any, X, Y, W>
typealias LocalAlias2<W> = <!OTHER_ERROR!>A<T, F, Any, X, Y, W><!>
}
class Derived2 : LocalOuter2<Double, Short>() {
fun foo(): LocalInner2<Long> = null!!
fun bar(): LocalAlias2<Char> = null!!
fun bar(): <!OTHER_ERROR, OTHER_ERROR!>LocalAlias2<Char><!> = null!!
}
Derived2()
}
@@ -10,7 +10,7 @@ open class BaseDerived2<X> : BaseDerived1<String, X>()
class Derived : BaseDerived2<Int>() {
fun foo(): Inner<Char> = null!!
fun baz(): Alias<Char> = null!!
fun baz(): <!OTHER_ERROR, OTHER_ERROR!>Alias<Char><!> = null!!
}
fun foo() {