Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
// +JDK
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
fun ff<T>(l: Collection<T>) = l is List<T>
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
// +JDK
|
||||
|
||||
import java.util.List
|
||||
|
||||
fun f(a : List<out Any>) = a is <!CANNOT_CHECK_FOR_ERASED!>List<out Int><!>
|
||||
@@ -4,7 +4,7 @@ fun <T> Array<out T>.safeGet(index : Int) : T? {
|
||||
return if (index < size) this[index] else null
|
||||
}
|
||||
|
||||
val args : Array<String> = Array<String>(1)
|
||||
val args : Array<String> = Array<String>(1, {""})
|
||||
val name : String = <!TYPE_MISMATCH!>args.safeGet<String>(0)<!> // No error, must be type mismatch
|
||||
val name1 : String? = args.safeGet(0)
|
||||
|
||||
|
||||
@@ -4,5 +4,5 @@
|
||||
class IdUnavailableException() : Exception() {}
|
||||
|
||||
fun <T : Any> T.getJavaClass() : Class<T> {
|
||||
return ((this <!CAST_NEVER_SUCCEEDS!>as<!> Object).getClass()) as Class<T> // Some error here, because of Exception() used above. ?!!!
|
||||
return <!UNCHECKED_CAST!>((this <!CAST_NEVER_SUCCEEDS!>as<!> Object).getClass()) as Class<T><!> // Some error here, because of Exception() used above. ?!!!
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
// KT-702 Type inference failed
|
||||
// +JDK
|
||||
fun getJavaClass<T>() : java.lang.Class<T> { return "" <!CAST_NEVER_SUCCEEDS!>as<!> Class<T> }
|
||||
|
||||
public class Throwables() {
|
||||
class object {
|
||||
public fun propagateIfInstanceOf<X : Throwable?>(throwable : Throwable?, declaredType : Class<X?>?) {
|
||||
if (((throwable != null) && declaredType?.isInstance(throwable).sure()))
|
||||
{
|
||||
throw declaredType?.cast(throwable)
|
||||
}
|
||||
}
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user