[FIR] Fix invalid diagnostic fir node sites and improved invalid type parameters count diagnostic report

This commit is contained in:
Igor Yakovlev
2021-01-18 22:39:41 +03:00
parent b7d3469819
commit 2e4daee1d4
50 changed files with 118 additions and 125 deletions
@@ -1,7 +1,7 @@
package p
public fun foo(a: Any) {
a is Map<Int>
a is <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Map<Int><!>
a is <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Map<!>
a is Map<out Any?, Any?>
a is Map<*, *>
@@ -1,6 +1,6 @@
public fun foo(a: Any, b: Map) {
public fun foo(a: Any, b: <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Map<!>) {
when (a) {
is Map<Int> -> {}
is <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Map<Int><!> -> {}
is <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Map<!> -> {}
is Map<out Any?, Any?> -> {}
is Map<*, *> -> {}
@@ -55,7 +55,7 @@ object MessageManager10 : <!UNRESOLVED_REFERENCE!>Message5<Int><!>() {
fun <T : Int> execute() {}
}
class MessageManager11<A> : <!UNRESOLVED_REFERENCE!>Message5<Message5<A>><!>() {
class MessageManager11<A> : <!UNRESOLVED_REFERENCE!>Message5<<!UNRESOLVED_REFERENCE!>Message5<A><!>><!>() {
fun <T : <!UNRESOLVED_REFERENCE!>Message5<A><!>> execute() {}
}
@@ -23,13 +23,13 @@ fun test() {
Foo<String>.Bar.Baz::class
a<Foo<String>.Bar>()
a<Foo<String>.Bar.Baz>()
a<<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Foo<String>.Bar.Baz<!>>()
a<Foo.Bar<Int>>()
a<Foo.Bar<Int>.Baz>()
a<<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Foo.Bar<Int>.Baz<!>>()
}
fun <T: <!UNRESOLVED_REFERENCE!>Foo<String.Bar><!>> x() {}
fun <T: Foo<<!UNRESOLVED_REFERENCE!>String.Bar<!>>> x() {}
fun Foo<String>.Bar.ext() {}
fun ex1(a: <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Foo<String>.Bar<String><!>): <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Foo<String>.Bar<String><!> {
@@ -15,6 +15,6 @@ class Outer<E> {
fun bare(x: Outer<*>.Inner<*, *>.Inner2Base, y: Outer<*>.Inner<*, *>.Inner3Base<Int>) {
if (x is Outer.Inner.Inner2) return
if (y is Outer.Inner.Inner3) return
if (y is Outer<String>.Inner.Inner3) return
if (y is Outer.Inner<String, Int>.Inner3<Double>) return
if (y is <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Outer<String>.Inner.Inner3<!>) return
if (y is <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Outer.Inner<String, Int>.Inner3<Double><!>) return
}
@@ -10,7 +10,7 @@ private fun <E> foobar() = {
fun a() = A<E, X, Y, Z>()
}
typealias LocalAlias<W> = <!UNRESOLVED_REFERENCE!>A<E, X, Y, W><!>
typealias LocalAlias<W> = A<<!UNRESOLVED_REFERENCE!>E<!>, <!UNRESOLVED_REFERENCE!>X<!>, <!UNRESOLVED_REFERENCE!>Y<!>, <!UNRESOLVED_REFERENCE!>W<!>>
}
class Derived : LocalOuter<Double, Short>() {
@@ -27,7 +27,7 @@ private fun noParameters() = {
fun a() = A<Any, X, Y, Z>()
}
typealias LocalAlias2<W> = <!UNRESOLVED_REFERENCE!>A<Any, X, Y, W><!>
typealias LocalAlias2<W> = A<<!UNRESOLVED_REFERENCE!>Any<!>, <!UNRESOLVED_REFERENCE!>X<!>, <!UNRESOLVED_REFERENCE!>Y<!>, <!UNRESOLVED_REFERENCE!>W<!>>
}
class Derived2 : LocalOuter2<Double, Short>() {
@@ -12,7 +12,7 @@ class Outer<T> {
fun a() = A<T, F, E, X, Y, Z>()
}
typealias LocalAlias<W> = <!UNRESOLVED_REFERENCE!>A<T, F, E, X, Y, W><!>
typealias LocalAlias<W> = A<<!UNRESOLVED_REFERENCE!>T<!>, <!UNRESOLVED_REFERENCE!>F<!>, <!UNRESOLVED_REFERENCE!>E<!>, <!UNRESOLVED_REFERENCE!>X<!>, <!UNRESOLVED_REFERENCE!>Y<!>, <!UNRESOLVED_REFERENCE!>W<!>>
}
class Derived : LocalOuter<Double, Short>() {
@@ -29,7 +29,7 @@ class Outer<T> {
fun a() = A<T, F, Any, X, Y, Z>()
}
typealias LocalAlias2<W> = <!UNRESOLVED_REFERENCE!>A<T, F, Any, X, Y, W><!>
typealias LocalAlias2<W> = A<<!UNRESOLVED_REFERENCE!>T<!>, <!UNRESOLVED_REFERENCE!>F<!>, <!UNRESOLVED_REFERENCE!>Any<!>, <!UNRESOLVED_REFERENCE!>X<!>, <!UNRESOLVED_REFERENCE!>Y<!>, <!UNRESOLVED_REFERENCE!>W<!>>
}
class Derived2 : LocalOuter2<Double, Short>() {
@@ -17,4 +17,4 @@ class Outer<E> {
class E
fun bar(x: Inner) {}
fun bar(x: <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Inner<!>) {}
@@ -15,9 +15,9 @@ class A<T> {
val y: B<String>.C<String>? = null
val z: B<String>.D? = null
val c: C<Int>? = null
val d: D? = null
val c: <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>C<Int>?<!> = null
val d: <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>D?<!> = null
val innerMost: Innermost<String>? = null
val innerMost: <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Innermost<String>?<!> = null
}
}
@@ -4,7 +4,7 @@
class Outer<T> {
inner class Inner
fun foo(x: Outer<String>.Inner, y: Outer.Inner, z: Inner) {
fun foo(x: Outer<String>.Inner, y: <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Outer.Inner<!>, z: Inner) {
var inner = Inner()
x.checkType { <!INAPPLICABLE_CANDIDATE!>_<!><Inner>() }
x.checkType { _<Outer<String>.Inner>() }
@@ -42,7 +42,7 @@ fun errorTypeWithArguments(): <!UNRESOLVED_REFERENCE!>Q<A>.W<B, C, D>.R.M<!> = n
fun error1(): Outer<A>.Inner<B>.Inner3<C, D> = null!!
fun error2(): <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Outer<A>.Inner<B, C, D>.Inner2<!> = null!!
fun error3(): Outer.Inner<A, B>.Inner3<C> = null!!
fun error3(): <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Outer.Inner<A, B>.Inner3<C><!> = null!!
fun error4(): <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Outer<A>.Nested<B>.Inner4<C><!> = null!!
fun error5(): <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Outer<A>.Obj.Nested2<B>.Inner5<C><!> = null!!
@@ -1,19 +1,19 @@
class A
interface I0<T : A<Int>>
interface I1<T> where T : A<Int>
interface I2<T : A<Int>> where T : A<Int>
interface I0<T : <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>A<Int><!>>
interface I1<T> where T : <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>A<Int><!>
interface I2<T : <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>A<Int><!>> where T : <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>A<Int><!>
fun <E : A<Int>> foo0() {}
fun <E> foo1() where E : A<Int> {}
fun <E : A<Int>> foo2() where E : A<Int> {}
fun <E : <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>A<Int><!>> foo0() {}
fun <E> foo1() where E : <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>A<Int><!> {}
fun <E : <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>A<Int><!>> foo2() where E : <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>A<Int><!> {}
val <E : A<Int>> E.p1: Int
val <E : <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>A<Int><!>> E.p1: Int
get() = 1
val <E> E.p2: Int where E : A<Int>
val <E> E.p2: Int where E : <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>A<Int><!>
get() = 1
val <E : A<Int>> E.p3: Int where E : A<Int>
val <E : <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>A<Int><!>> E.p3: Int where E : <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>A<Int><!>
get() = 1
// See KT-8200
interface X
public class EnumAttribute<T : X<T>>(val klass: Class<T>) where T : Enum<T>
public class EnumAttribute<T : <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>X<T><!>>(val klass: Class<T>) where T : Enum<T>