drop BASE_WITH_NULLABLE_UPPER_BOUND
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER,-UNUSED_VARIABLE,-BASE_WITH_NULLABLE_UPPER_BOUND
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER,-UNUSED_VARIABLE
|
||||
|
||||
fun <E> bar(x: E) {}
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// !CHECK_TYPE
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER, -BASE_WITH_NULLABLE_UPPER_BOUND, -UNUSED_VARIABLE
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER,-UNUSED_VARIABLE
|
||||
|
||||
class A<F> {
|
||||
fun <E : F> foo1(x: E) = x
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// !CHECK_TYPE
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER, -BASE_WITH_NULLABLE_UPPER_BOUND, -UNUSED_VARIABLE
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER,-UNUSED_VARIABLE
|
||||
|
||||
class A<F> {
|
||||
class Inv<Q>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VALUE,-UNUSED_VARIABLE,-ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE,-BASE_WITH_NULLABLE_UPPER_BOUND,-VARIABLE_WITH_REDUNDANT_INITIALIZER
|
||||
// !DIAGNOSTICS: -UNUSED_VALUE,-UNUSED_VARIABLE,-ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE,-VARIABLE_WITH_REDUNDANT_INITIALIZER
|
||||
|
||||
class A<T : CharSequence?, E1 : T, E2: T?> {
|
||||
fun T.bar() {}
|
||||
|
||||
Vendored
-1
@@ -1,4 +1,3 @@
|
||||
// !DIAGNOSTICS: -BASE_WITH_NULLABLE_UPPER_BOUND
|
||||
// !CHECK_TYPE
|
||||
interface A<T>
|
||||
|
||||
|
||||
Vendored
-1
@@ -1,4 +1,3 @@
|
||||
// !DIAGNOSTICS: -BASE_WITH_NULLABLE_UPPER_BOUND
|
||||
// !CHECK_TYPE
|
||||
interface A<T>
|
||||
|
||||
|
||||
Vendored
-1
@@ -1,4 +1,3 @@
|
||||
// !DIAGNOSTICS: -BASE_WITH_NULLABLE_UPPER_BOUND
|
||||
// !CHECK_TYPE
|
||||
interface A<T>
|
||||
|
||||
|
||||
+1
-1
@@ -21,6 +21,6 @@ fun tests() {
|
||||
}
|
||||
|
||||
// from standard library
|
||||
operator fun <K, V> MutableMap<K, V>.set(key : K, value : V) : V<!BASE_WITH_NULLABLE_UPPER_BOUND!>?<!> = this.put(key, value)
|
||||
operator fun <K, V> MutableMap<K, V>.set(key : K, value : V) : V? = this.put(key, value)
|
||||
|
||||
fun println(message : Any?) = System.out.println(message)
|
||||
+1
-1
@@ -5,4 +5,4 @@ fun test(map: MutableMap<Int, Int>, t: Int) {
|
||||
}
|
||||
|
||||
//from library
|
||||
operator fun <K, V> MutableMap<K, V>.set(key : K, value : V) : V<!BASE_WITH_NULLABLE_UPPER_BOUND!>?<!> = this.put(key, value)
|
||||
operator fun <K, V> MutableMap<K, V>.set(key : K, value : V) : V? = this.put(key, value)
|
||||
@@ -4,6 +4,6 @@ fun foo(): String? {
|
||||
return accept(JV<String?, Unit?>())
|
||||
}
|
||||
|
||||
fun <R, D> accept(<!UNUSED_PARAMETER!>v<!>: JV<R, D>): R<!BASE_WITH_NULLABLE_UPPER_BOUND!>?<!> = null
|
||||
fun <R, D> accept(<!UNUSED_PARAMETER!>v<!>: JV<R, D>): R? = null
|
||||
|
||||
open class JV<R, D>()
|
||||
@@ -1,6 +1,6 @@
|
||||
// KT-3559 Strange inference failure error message
|
||||
|
||||
public inline fun <T:Any, R> let(subj: T?, body: (T) -> R): R<!BASE_WITH_NULLABLE_UPPER_BOUND!>?<!> {
|
||||
public inline fun <T:Any, R> let(subj: T?, body: (T) -> R): R? {
|
||||
return if (subj != null) body(<!DEBUG_INFO_SMARTCAST!>subj<!>) else null
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ fun <T> getJavaClass() : java.lang.Class<T> { <!NO_RETURN_IN_FUNCTION_WITH_BLOCK
|
||||
|
||||
public class Throwables() {
|
||||
companion object {
|
||||
public fun <X : Throwable?> propagateIfInstanceOf(throwable : Throwable?, declaredType : Class<X<!BASE_WITH_NULLABLE_UPPER_BOUND!>?<!>>?) : Unit {
|
||||
public fun <X : Throwable?> propagateIfInstanceOf(throwable : Throwable?, declaredType : Class<X?>?) : Unit {
|
||||
if (((throwable != null) && declaredType?.isInstance(throwable)!!))
|
||||
{
|
||||
throw declaredType?.cast(throwable)!!
|
||||
@@ -17,5 +17,4 @@ public class Throwables() {
|
||||
propagateIfInstanceOf(throwable, getJavaClass<RuntimeException?>()) // Type inference failed: Mismatch while expanding constraints
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
val <T> T.foo : T<!BASE_WITH_NULLABLE_UPPER_BOUND!>?<!>
|
||||
val <T> T.foo : T?
|
||||
get() = null
|
||||
|
||||
fun test(): Int? {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// !DIAGNOSTICS: -BASE_WITH_NULLABLE_UPPER_BOUND -UNNECESSARY_SAFE_CALL
|
||||
// !DIAGNOSTICS: -UNNECESSARY_SAFE_CALL
|
||||
|
||||
// MODULE: m1
|
||||
// FILE: a.kt
|
||||
|
||||
-2
@@ -1,5 +1,3 @@
|
||||
// !DIAGNOSTICS: -BASE_WITH_NULLABLE_UPPER_BOUND
|
||||
|
||||
// MODULE: m1
|
||||
// FILE: a.kt
|
||||
package p
|
||||
|
||||
+7
-7
@@ -9,16 +9,16 @@ fun <NN: Any, TWO_BOUNDS> twoBounds(
|
||||
) where TWO_BOUNDS: Any, TWO_BOUNDS : NN {}
|
||||
|
||||
fun <T, N: T, INDIRECT: N> misleadingNullableSimple(
|
||||
<!UNUSED_PARAMETER!>t<!>: T<!BASE_WITH_NULLABLE_UPPER_BOUND!>?<!>,
|
||||
<!UNUSED_PARAMETER!>t2<!>: T<!BASE_WITH_NULLABLE_UPPER_BOUND!>?<!>,
|
||||
<!UNUSED_PARAMETER!>n<!>: N<!BASE_WITH_NULLABLE_UPPER_BOUND!>?<!>,
|
||||
<!UNUSED_PARAMETER!>ind<!>: INDIRECT<!BASE_WITH_NULLABLE_UPPER_BOUND!>?<!>
|
||||
<!UNUSED_PARAMETER!>t<!>: T?,
|
||||
<!UNUSED_PARAMETER!>t2<!>: T?,
|
||||
<!UNUSED_PARAMETER!>n<!>: N?,
|
||||
<!UNUSED_PARAMETER!>ind<!>: INDIRECT?
|
||||
) {}
|
||||
|
||||
fun <FIRST_BOUND, SECOND_BOUND> misleadingNullableMultiBound(
|
||||
<!UNUSED_PARAMETER!>fb<!>: FIRST_BOUND<!BASE_WITH_NULLABLE_UPPER_BOUND!>?<!>,
|
||||
<!UNUSED_PARAMETER!>sb<!>: SECOND_BOUND<!BASE_WITH_NULLABLE_UPPER_BOUND!>?<!>
|
||||
<!UNUSED_PARAMETER!>fb<!>: FIRST_BOUND?,
|
||||
<!UNUSED_PARAMETER!>sb<!>: SECOND_BOUND?
|
||||
) where FIRST_BOUND: Any?, FIRST_BOUND: Any, SECOND_BOUND: Any, SECOND_BOUND: Any? {
|
||||
}
|
||||
|
||||
fun <T> interactionWithRedundant(<!UNUSED_PARAMETER!>t<!>: T<!BASE_WITH_NULLABLE_UPPER_BOUND!>?<!><!REDUNDANT_NULLABLE!>?<!>) {}
|
||||
fun <T> interactionWithRedundant(<!UNUSED_PARAMETER!>t<!>: T?<!REDUNDANT_NULLABLE!>?<!>) {}
|
||||
-1
@@ -1,5 +1,4 @@
|
||||
// !EXPLICIT_FLEXIBLE_TYPES
|
||||
// !DIAGNOSTICS: -BASE_WITH_NULLABLE_UPPER_BOUND
|
||||
|
||||
interface A<T>
|
||||
interface B<T>: A<ft<T, T?>>
|
||||
|
||||
@@ -3,11 +3,10 @@ public inline fun <reified T> Array(n: Int, block: (Int) -> T): Array<T> = null!
|
||||
|
||||
// KT-312 Nullability problem when a nullable version of a generic type is returned
|
||||
|
||||
fun <T> Array<out T>.safeGet(index : Int) : T<!BASE_WITH_NULLABLE_UPPER_BOUND!>?<!> {
|
||||
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 name : String = <!TYPE_MISMATCH!>args.safeGet<String>(0)<!> // No error, must be type mismatch
|
||||
val name1 : String? = args.safeGet(0)
|
||||
|
||||
val name1 : String? = args.safeGet(0)
|
||||
@@ -3,7 +3,7 @@ fun <T> getJavaClass() : java.lang.Class<T> { return "" <!CAST_NEVER_SUCCEEDS!>a
|
||||
|
||||
public class Throwables() {
|
||||
companion object {
|
||||
public fun <X : Throwable?> propagateIfInstanceOf(throwable : Throwable?, declaredType : Class<X<!BASE_WITH_NULLABLE_UPPER_BOUND!>?<!>>?) {
|
||||
public fun <X : Throwable?> propagateIfInstanceOf(throwable : Throwable?, declaredType : Class<X?>?) {
|
||||
if (((throwable != null) && declaredType?.isInstance(throwable)!!))
|
||||
{
|
||||
throw declaredType?.cast(throwable)!!
|
||||
@@ -14,4 +14,4 @@ public class Throwables() {
|
||||
propagateIfInstanceOf(throwable, getJavaClass<RuntimeException?>()) // Type inference failed: Mismatch while expanding constraints
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user