FIR: report NO_TYPE_ARGUMENTS_ON_RHS properly
This commit is contained in:
@@ -4,7 +4,7 @@ interface Tr
|
||||
interface G<T>
|
||||
|
||||
fun test(tr: Tr) {
|
||||
val v = tr as <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>G?<!>
|
||||
val v = tr as <!NO_TYPE_ARGUMENTS_ON_RHS!>G?<!>
|
||||
// If v is not nullable, there will be a warning on this line:
|
||||
<!INAPPLICABLE_CANDIDATE!>checkSubtype<!><G<*>>(v!!)
|
||||
}
|
||||
@@ -4,6 +4,6 @@ interface Tr
|
||||
interface G<T>
|
||||
|
||||
fun test(tr: Tr?) {
|
||||
val v = tr as <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>G<!>
|
||||
val v = tr as <!NO_TYPE_ARGUMENTS_ON_RHS!>G<!>
|
||||
<!INAPPLICABLE_CANDIDATE!>checkSubtype<!><G<*>>(v)
|
||||
}
|
||||
+1
-1
@@ -4,6 +4,6 @@ interface Tr
|
||||
interface G<T>
|
||||
|
||||
fun test(tr: Tr?) {
|
||||
val v = tr as <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>G?<!>
|
||||
val v = tr as <!NO_TYPE_ARGUMENTS_ON_RHS!>G?<!>
|
||||
<!INAPPLICABLE_CANDIDATE!>checkSubtype<!><G<*>>(v!!)
|
||||
}
|
||||
@@ -4,6 +4,6 @@ interface Tr
|
||||
interface G<T>
|
||||
|
||||
fun test(tr: Tr) {
|
||||
val v = tr as <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>G<!>
|
||||
val v = tr as <!NO_TYPE_ARGUMENTS_ON_RHS!>G<!>
|
||||
<!INAPPLICABLE_CANDIDATE!>checkSubtype<!><G<*>>(v)
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
interface Tr
|
||||
interface G<T>
|
||||
|
||||
fun test(tr: Tr) = tr is <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>G<!>
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
interface Tr
|
||||
interface G<T>
|
||||
|
||||
|
||||
@@ -2,13 +2,13 @@ package p
|
||||
|
||||
public fun foo(a: Any) {
|
||||
a is <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Map<Int><!>
|
||||
a is <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Map<!>
|
||||
a is <!NO_TYPE_ARGUMENTS_ON_RHS!>Map<!>
|
||||
a is Map<out Any?, Any?>
|
||||
a is Map<*, *>
|
||||
a is Map<<!SYNTAX!><!>>
|
||||
a is List<Map>
|
||||
a is <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>List<!>
|
||||
a is <!NO_TYPE_ARGUMENTS_ON_RHS!>List<!>
|
||||
a is Int
|
||||
|
||||
(a as <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Map<!>) is Int
|
||||
(a as <!NO_TYPE_ARGUMENTS_ON_RHS!>Map<!>) is Int
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
public fun foo(a: Any, b: <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Map<!>) {
|
||||
when (a) {
|
||||
is <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Map<Int><!> -> {}
|
||||
is <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Map<!> -> {}
|
||||
is <!NO_TYPE_ARGUMENTS_ON_RHS!>Map<!> -> {}
|
||||
is Map<out Any?, Any?> -> {}
|
||||
is Map<*, *> -> {}
|
||||
is Map<<!SYNTAX!><!>> -> {}
|
||||
is List<Map> -> {}
|
||||
is <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>List<!> -> {}
|
||||
is <!NO_TYPE_ARGUMENTS_ON_RHS!>List<!> -> {}
|
||||
is Int -> {}
|
||||
else -> {}
|
||||
}
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ class DerivedOuter<G> : SuperOuter<G>() {
|
||||
|
||||
fun bare(x: SuperOuter<*>.SuperInner<*>, y: Any?) {
|
||||
if (x is SuperOuter.SuperInner) return
|
||||
if (y is <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>SuperOuter.SuperInner<!>) {
|
||||
if (y is <!NO_TYPE_ARGUMENTS_ON_RHS!>SuperOuter.SuperInner<!>) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -12,7 +12,7 @@ class Outer<E> {
|
||||
x.prop.checkType { _<E>() }
|
||||
}
|
||||
|
||||
if (y is <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Inner<!>) return
|
||||
if (y is <!NO_TYPE_ARGUMENTS_ON_RHS!>Inner<!>) return
|
||||
|
||||
if (z is Inner) {
|
||||
z.prop.checkType { _<Any?>() }
|
||||
@@ -26,7 +26,7 @@ class Outer<E> {
|
||||
|
||||
fun bar(x: InnerBase<String>, y: Any?, z: Outer<*>.InnerBase<String>) {
|
||||
x as Inner
|
||||
y as <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Inner<!>
|
||||
y as <!NO_TYPE_ARGUMENTS_ON_RHS!>Inner<!>
|
||||
z as Inner
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,8 +14,8 @@ fun testNL1(x: Collection<Int>?): Boolean = x is NL
|
||||
fun testNL2(x: Collection<Int>?): List<Int>? = x as NL
|
||||
fun testNL3(x: Collection<Int>?): List<Int>? = x as NL?
|
||||
|
||||
fun testLStar(x: Collection<Int>): List<Int> = x as <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>LStar<!>
|
||||
fun testMyList(x: Collection<Int>): List<Int> = x as <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>MyList<!>
|
||||
fun testLStar(x: Collection<Int>): List<Int> = x as <!NO_TYPE_ARGUMENTS_ON_RHS!>LStar<!>
|
||||
fun testMyList(x: Collection<Int>): List<Int> = x as <!NO_TYPE_ARGUMENTS_ON_RHS!>MyList<!>
|
||||
|
||||
typealias MMTT<T> = MutableMap<T, T>
|
||||
typealias Dictionary<T> = MutableMap<String, T>
|
||||
@@ -24,8 +24,8 @@ typealias ReadableList<T> = MutableList<out T>
|
||||
|
||||
fun testWrong1(x: Map<Any, Any>) = x is MMTT
|
||||
fun testWrong2(x: Map<Any, Any>) = x is Dictionary
|
||||
fun testWrong3(x: Map<Any, Any>) = x is <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>WriteableMap<!>
|
||||
fun testWrong4(x: List<Any>) = x is <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>ReadableList<!>
|
||||
fun testWrong3(x: Map<Any, Any>) = x is <!NO_TYPE_ARGUMENTS_ON_RHS!>WriteableMap<!>
|
||||
fun testWrong4(x: List<Any>) = x is <!NO_TYPE_ARGUMENTS_ON_RHS!>ReadableList<!>
|
||||
|
||||
fun <T> testLocal(x: Any) {
|
||||
class C
|
||||
|
||||
Reference in New Issue
Block a user