added tests for specific type inference errors
This commit is contained in:
@@ -0,0 +1,19 @@
|
|||||||
|
package conflictingSubstitutions
|
||||||
|
//+JDK
|
||||||
|
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
fun <R> elemAndList(r: R, <!UNUSED_PARAMETER!>t<!>: List<R>): R = r
|
||||||
|
fun <R> R.elemAndListWithReceiver(r: R, <!UNUSED_PARAMETER!>t<!>: List<R>): R = r
|
||||||
|
|
||||||
|
fun test() {
|
||||||
|
val <!UNUSED_VARIABLE!>s<!> = <!TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS!>elemAndList<!>(11, list("72"))
|
||||||
|
|
||||||
|
val <!UNUSED_VARIABLE!>u<!> = 11.<!TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS!>elemAndListWithReceiver<!>(4, list("7"))
|
||||||
|
}
|
||||||
|
|
||||||
|
fun list<T>(value: T) : ArrayList<T> {
|
||||||
|
val list = ArrayList<T>()
|
||||||
|
list.add(value)
|
||||||
|
return list
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package noInformationForParameter
|
||||||
|
//+JDK
|
||||||
|
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
fun test() {
|
||||||
|
val <!UNUSED_VARIABLE!>n<!> = <!TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>newList<!>()
|
||||||
|
|
||||||
|
val <!UNUSED_VARIABLE!>n1<!> : List<String> = newList()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun newList<S>() : ArrayList<S> {
|
||||||
|
return ArrayList<S>()
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package typeConstructorMismatch
|
||||||
|
//+JDK
|
||||||
|
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
fun test(set: Set<String>) {
|
||||||
|
<!TYPE_INFERENCE_TYPE_CONSTRUCTOR_MISMATCH!>elemAndList<!>("2", set)
|
||||||
|
|
||||||
|
"".<!TYPE_INFERENCE_TYPE_CONSTRUCTOR_MISMATCH!>elemAndListWithReceiver<!>("", set)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun <R> elemAndList(r: R, <!UNUSED_PARAMETER!>t<!>: List<R>): R = r
|
||||||
|
fun <R> R.elemAndListWithReceiver(r: R, <!UNUSED_PARAMETER!>t<!>: List<R>): R = r
|
||||||
Reference in New Issue
Block a user