[FIR] Fix positioning and detecting of WRONG_NUMBER_OF_TYPE_ARGUMENTS

Refactor code and fix compilation errors caused by changes to symbol.fir
This commit is contained in:
Ivan Kochurkin
2021-07-06 22:23:04 +03:00
committed by TeamCityServer
parent 345152d198
commit dd54338ec0
49 changed files with 377 additions and 301 deletions
@@ -1,7 +1,7 @@
package p
public fun foo(a: Any) {
a is <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Map<Int><!>
a is Map<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><Int><!>
a is <!NO_TYPE_ARGUMENTS_ON_RHS!>Map<!>
a is Map<out Any?, Any?>
a is Map<*, *>
@@ -11,4 +11,4 @@ public fun foo(a: Any) {
a is Int
(a as <!NO_TYPE_ARGUMENTS_ON_RHS!>Map<!>) is Int
}
}
@@ -1,6 +1,6 @@
public fun foo(a: Any, b: <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Map<!>) {
when (a) {
is <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Map<Int><!> -> {}
is Map<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><Int><!> -> {}
is <!NO_TYPE_ARGUMENTS_ON_RHS!>Map<!> -> {}
is Map<out Any?, Any?> -> {}
is Map<*, *> -> {}
@@ -10,4 +10,4 @@ public fun foo(a: Any, b: <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Map<!>) {
is Int -> {}
else -> {}
}
}
}
@@ -23,14 +23,14 @@ fun test() {
Foo<String>.Bar.Baz::class
a<Foo<String>.Bar>()
a<<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Foo<String>.Bar.Baz<!>>()
a<Foo<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><String><!>.Bar.Baz>()
a<Foo.Bar<Int>>()
a<<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Foo.Bar<Int>.Baz<!>>()
a<Foo.Bar<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><Int><!>.Baz>()
}
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><!> {
fun ex1(a: Foo<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><String><!>.Bar<String>): Foo<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><String><!>.Bar<String> {
}
@@ -1,20 +0,0 @@
class Outer<E> {
inner class Inner<F, G> {
inner abstract class Inner2Base
inner class Inner2 : Inner2Base()
inner abstract class Inner3Base<B>
inner class Inner3<H> : Inner3Base<H>()
}
fun foo(x: Outer<*>.Inner<*, *>.Inner2Base) {
if (x is Inner.Inner2) return
}
}
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 <!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
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
class Outer<E> {
inner class Inner<F, G> {
inner abstract class Inner2Base
@@ -3,7 +3,7 @@
class Outer<T> {
inner class Inner
fun foo(x: Outer<String>.Inner, y: <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>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>() }
@@ -40,12 +40,12 @@ fun ok5(): test.Outer.Obj.Nested2<A>.Inner5<B> = null!!
// All arguments are resolved
fun errorTypeWithArguments(): <!UNRESOLVED_REFERENCE!>Q<A>.W<B, C, D>.R.M<!> = null!!
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(): <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Outer.Inner<A, B>.Inner3<C><!> = null!!
fun error1(): Outer<A>.Inner<B>.Inner3<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><C, D><!> = null!!
fun error2(): Outer<A>.Inner<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><B, C, D><!>.Inner2 = 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!!
fun error6(): <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Outer.Obj<A>.Nested2<B>.Inner5<C><!> = null!!
fun error4(): Outer<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><A><!>.Nested<B>.Inner4<C> = null!!
fun error5(): Outer<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><A><!>.Obj.Nested2<B>.Inner5<C> = null!!
fun error6(): Outer.Obj<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><A><!>.Nested2<B>.Inner5<C> = null!!
fun error7(): <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>test<String>.Outer.Obj.Nested2<A>.Inner5<B><!> = null!!
fun error7(): test<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><String><!>.Outer.Obj.Nested2<A>.Inner5<B> = null!!
@@ -1,19 +0,0 @@
class A
interface I0<T : <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>A<Int><!>>
interface I1<T> where T : <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>A<Int><!>
interface I2<<!MISPLACED_TYPE_PARAMETER_CONSTRAINTS!>T : <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>A<Int><!><!>> where T : <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>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 <<!MISPLACED_TYPE_PARAMETER_CONSTRAINTS!>E : <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>A<Int><!><!>> foo2() where E : <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>A<Int><!> {}
val <E : <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>A<Int><!>> E.p1: Int
get() = 1
val <E> E.p2: Int where E : <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>A<Int><!>
get() = 1
val <<!MISPLACED_TYPE_PARAMETER_CONSTRAINTS!>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<<!MISPLACED_TYPE_PARAMETER_CONSTRAINTS!>T : <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>X<T><!><!>>(val klass: Class<T>) where T : Enum<T>
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
class A
interface I0<T : A<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><Int><!>>
interface I1<T> where T : A<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><Int><!>