Do not allow inference of type arguments on the rhs if there's no information available

This commit is contained in:
Andrey Breslav
2013-09-12 21:13:11 +02:00
parent 5c86a5bd7c
commit a9134f8eff
20 changed files with 219 additions and 44 deletions
@@ -0,0 +1,8 @@
trait Tr
trait G<T>
fun test(tr: Tr) {
val v = tr as <!NO_TYPE_ARGUMENTS_ON_RHS!>G?<!>
// If v is not nullable, there will be a warning on this line:
v!!: G<*>
}
@@ -0,0 +1,6 @@
class G<T>
fun foo(p: <!UNRESOLVED_REFERENCE!>P<!>) {
val v = <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>p<!> <!USELESS_CAST!>as<!> <!NO_TYPE_ARGUMENTS_ON_RHS!>G?<!>
v!!: G<*>
}
@@ -0,0 +1,7 @@
trait Tr
trait G<T>
fun test(tr: Tr?) {
val v = tr as <!NO_TYPE_ARGUMENTS_ON_RHS!>G<!>
v: G<*>
}
@@ -0,0 +1,8 @@
trait Tr<T>
trait G<T> : Tr<T>
fun test(tr: Tr<String>?) {
val v = tr as G?
// If v is not nullable, there will be a warning on this line:
v!!: G<String>
}
@@ -0,0 +1,7 @@
trait Tr
trait G<T>
fun test(tr: Tr?) {
val v = tr as <!NO_TYPE_ARGUMENTS_ON_RHS!>G?<!>
v!!: G<*>
}
@@ -2,6 +2,6 @@ trait Tr
trait G<T>
fun test(tr: Tr) {
val v = tr as G
val v = tr as <!NO_TYPE_ARGUMENTS_ON_RHS!>G<!>
v: G<*>
}
}
@@ -1,4 +1,4 @@
trait Tr
trait G<T>
fun test(tr: Tr) = tr is G
fun test(tr: Tr) = tr is <!NO_TYPE_ARGUMENTS_ON_RHS!>G<!>