function invocation with only type parameters prohibited
This commit is contained in:
@@ -10,9 +10,9 @@ package boundsWithSubstitutors
|
||||
|
||||
class X<A, B : A>()
|
||||
|
||||
val b = X<Any, X<A<C>, C>>
|
||||
val b0 = X<Any, <!UPPER_BOUND_VIOLATED!>Any?<!>>
|
||||
val b1 = X<Any, X<A<C>, <!UPPER_BOUND_VIOLATED!>String<!>>>
|
||||
val b = X<Any, X<A<C>, C>>()
|
||||
val b0 = X<Any, <!UPPER_BOUND_VIOLATED!>Any?<!>>()
|
||||
val b1 = X<Any, X<A<C>, <!UPPER_BOUND_VIOLATED!>String<!>>>()
|
||||
|
||||
// FILE: b.kt
|
||||
open class A {}
|
||||
|
||||
@@ -18,8 +18,8 @@ fun test(<!UNUSED_PARAMETER!>l<!> : java.util.List<Int>) {
|
||||
|
||||
val <!UNUSED_VARIABLE!>f<!> : java.io.File? = null
|
||||
|
||||
Collections.<!UNRESOLVED_REFERENCE!>emptyList<!>
|
||||
Collections.emptyList<Int>
|
||||
Collections.<!TYPE_INFERENCE_FAILED, FUNCTION_CALL_EXPECTED!>emptyList<!>
|
||||
Collections.<!FUNCTION_CALL_EXPECTED!>emptyList<Int><!>
|
||||
Collections.emptyList<Int>()
|
||||
Collections.<!TYPE_INFERENCE_FAILED!>emptyList()<!>
|
||||
|
||||
@@ -51,4 +51,4 @@ fun test(<!UNUSED_PARAMETER!>l<!> : java.util.List<Int>) {
|
||||
|
||||
// FILE: f.kt
|
||||
package xxx
|
||||
import java.lang.Class;
|
||||
import java.lang.Class;
|
||||
@@ -4,12 +4,12 @@ package kotlin1
|
||||
import java.util.*
|
||||
|
||||
fun main(args : Array<String>) {
|
||||
val al : ArrayList<Int> = ArrayList<Int>
|
||||
val al : ArrayList<Int> = ArrayList<Int>()
|
||||
val al1 = ArrayList<Int>(1)
|
||||
// for (x in al1) {
|
||||
//
|
||||
// }
|
||||
val <!UNUSED_VARIABLE!>al2<!> = ArrayList<Int>(ArrayList<Int>)
|
||||
val <!UNUSED_VARIABLE!>al2<!> = ArrayList<Int>(ArrayList<Int>())
|
||||
al : RandomAccess
|
||||
al.clear() : Unit
|
||||
al.add(1) : Boolean
|
||||
|
||||
@@ -4,6 +4,6 @@ package kotlin1
|
||||
import java.util.*
|
||||
|
||||
fun main(args : Array<String>) {
|
||||
val al : ArrayList<Int> = ArrayList<Int>
|
||||
val al : ArrayList<Int> = ArrayList<Int>()
|
||||
al.clone() : Object // A type mismatch on this line means that alt-headers were not loaded
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ package kotlin1
|
||||
import java.util.*
|
||||
|
||||
fun main(args : Array<String>) {
|
||||
val al : ArrayList<Int> = ArrayList<Int>
|
||||
val al : ArrayList<Int> = ArrayList<Int>()
|
||||
|
||||
// A type mismatch on this line means that alt-headers were not loaded
|
||||
al.toArray(Array<Int>(3, {1})) : Array<Int>
|
||||
|
||||
@@ -9,5 +9,5 @@ package a
|
||||
|
||||
fun foo() {
|
||||
// If this fails, it means that we have broken the rule that Java returns are always nullable
|
||||
a.Test<Int>.t() <!UNSAFE_INFIX_CALL!>+<!> 1
|
||||
a.Test<Int>().t() <!UNSAFE_INFIX_CALL!>+<!> 1
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ abstract class Item(val room: Object) {
|
||||
abstract val name : String
|
||||
}
|
||||
|
||||
val items: ArrayList<Item> = ArrayList<Item>
|
||||
val items: ArrayList<Item> = ArrayList<Item>()
|
||||
|
||||
fun test(room : Object) {
|
||||
for(val item: Item? in items) {
|
||||
|
||||
@@ -3,7 +3,7 @@ class Point() {
|
||||
|
||||
class G<T>() {}
|
||||
|
||||
fun f<T>(<!UNUSED_PARAMETER!>expression<!> : T) : G<out T> = G<T>
|
||||
fun f<T>(<!UNUSED_PARAMETER!>expression<!> : T) : G<out T> = G<T>()
|
||||
|
||||
|
||||
fun foo() : G<Point> {
|
||||
@@ -13,7 +13,7 @@ fun foo() : G<Point> {
|
||||
|
||||
class Out<out T>() {}
|
||||
|
||||
fun fout<T>(<!UNUSED_PARAMETER!>expression<!> : T) : Out<out T> = Out<T>
|
||||
fun fout<T>(<!UNUSED_PARAMETER!>expression<!> : T) : Out<out T> = Out<T>()
|
||||
|
||||
fun fooout() : Out<Point> {
|
||||
val p = Point();
|
||||
|
||||
@@ -8,7 +8,7 @@ fun iarray(vararg a : String) = a // BUG
|
||||
|
||||
fun main() {
|
||||
val vals = iarray("789", "678", "567")
|
||||
val diffs = ArrayList<Int>
|
||||
val diffs = ArrayList<Int>()
|
||||
for (i in vals.indices) {
|
||||
for (j in i..vals.lastIndex()) // Type inference failed
|
||||
diffs.add(vals[i].length - vals[j].length)
|
||||
|
||||
@@ -10,8 +10,8 @@ public class Throwables() {
|
||||
}
|
||||
}
|
||||
public fun propagateIfPossible(throwable : Throwable?) {
|
||||
propagateIfInstanceOf(throwable, getJavaClass<Error?>) //; Type inference failed: Mismatch while expanding constraints
|
||||
propagateIfInstanceOf(throwable, getJavaClass<RuntimeException?>) // Type inference failed: Mismatch while expanding constraints
|
||||
propagateIfInstanceOf(throwable, getJavaClass<Error?>()) //; Type inference failed: Mismatch while expanding constraints
|
||||
propagateIfInstanceOf(throwable, getJavaClass<RuntimeException?>()) // Type inference failed: Mismatch while expanding constraints
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,8 +9,8 @@ fun <T> TypeInfo<T>.getJavaClass() : java.lang.Class<T> {
|
||||
return <!UNCHECKED_CAST!>t.getClass() as java.lang.Class<T><!> // inferred type is Object but Serializable was expected
|
||||
}
|
||||
|
||||
fun getJavaClass<T>() = typeinfo<T>.getJavaClass()
|
||||
fun getJavaClass<T>() = typeinfo<T>().getJavaClass()
|
||||
|
||||
fun main(args : Array<String>) {
|
||||
System.out.println(getJavaClass<String>)
|
||||
System.out.println(getJavaClass<String>())
|
||||
}
|
||||
|
||||
@@ -3,5 +3,5 @@ import java.util.ArrayList
|
||||
class MyListOfPairs<T> : ArrayList<#(T, T)>() { }
|
||||
|
||||
fun test() {
|
||||
MyListOfPairs<Int> : ArrayList<#(Int, Int)>
|
||||
MyListOfPairs<Int>() : ArrayList<#(Int, Int)>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user