Switch kotlin version to 1.7
* Change 1.6 to 1.7 constants * Fix SAFE_CALL_WILL_CHANGE_NULLABILITY for testData * Change EXPOSED_PROPERTY_TYPE_IN_CONSTRUCTOR_WARNING to EXPOSED_PROPERTY_TYPE_IN_CONSTRUCTOR_ERROR * Change NON_EXHAUSTIVE_WHEN_STATEMENT to NO_ELSE_IN_WHEN * Fix testData for SafeCallsAreAlwaysNullable * Change T -> T & Any in test dumps * Change INVALID_CHARACTERS_NATIVE_WARNING -> INVALID_CHARACTERS_NATIVE_ERROR * TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM_WARNING -> TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM_ERROR
This commit is contained in:
@@ -25,11 +25,11 @@ FILE fqName:<root> fileName:/bangbang.kt
|
||||
if: CONST Boolean type=kotlin.Boolean value=true
|
||||
then: CALL 'public open fun hashCode (): kotlin.Int declared in kotlin.Any' type=kotlin.Int origin=null
|
||||
$this: GET_VAR 'val tmp_0: kotlin.Any? [val] declared in <root>.test2' type=kotlin.Any? origin=null
|
||||
FUN name:test3 visibility:public modality:FINAL <X> (a:X of <root>.test3) returnType:X of <root>.test3
|
||||
FUN name:test3 visibility:public modality:FINAL <X> (a:X of <root>.test3) returnType:{X of <root>.test3 & Any}
|
||||
TYPE_PARAMETER name:X index:0 variance: superTypes:[kotlin.Any?]
|
||||
VALUE_PARAMETER name:a index:0 type:X of <root>.test3
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun test3 <X> (a: X of <root>.test3): X of <root>.test3 declared in <root>'
|
||||
RETURN type=kotlin.Nothing from='public final fun test3 <X> (a: X of <root>.test3): {X of <root>.test3 & Any} declared in <root>'
|
||||
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type={X of <root>.test3 & Any} origin=EXCLEXCL
|
||||
<T0>: X of <root>.test3
|
||||
arg0: GET_VAR 'a: X of <root>.test3 declared in <root>.test3' type=X of <root>.test3 origin=null
|
||||
|
||||
@@ -12,7 +12,7 @@ fun test2(a: Any?): Int {
|
||||
})
|
||||
}
|
||||
|
||||
fun <X : Any?> test3(a: X): X {
|
||||
fun <X : Any?> test3(a: X): (X & Any) {
|
||||
return CHECK_NOT_NULL<X>(arg0 = a)
|
||||
}
|
||||
|
||||
@@ -27,3 +27,4 @@ fun <X : Any?> test4(a: X) {
|
||||
a is String? -> useString(s = CHECK_NOT_NULL<String>(arg0 = a /*as String? */))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -25,11 +25,11 @@ FILE fqName:<root> fileName:/bangbang.kt
|
||||
if: CONST Boolean type=kotlin.Boolean value=true
|
||||
then: CALL 'public open fun hashCode (): kotlin.Int declared in kotlin.Any' type=kotlin.Int origin=null
|
||||
$this: GET_VAR 'val tmp_0: kotlin.Any? [val] declared in <root>.test2' type=kotlin.Any? origin=null
|
||||
FUN name:test3 visibility:public modality:FINAL <X> (a:X of <root>.test3) returnType:X of <root>.test3
|
||||
FUN name:test3 visibility:public modality:FINAL <X> (a:X of <root>.test3) returnType:{X of <root>.test3 & Any}
|
||||
TYPE_PARAMETER name:X index:0 variance: superTypes:[kotlin.Any?]
|
||||
VALUE_PARAMETER name:a index:0 type:X of <root>.test3
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun test3 <X> (a: X of <root>.test3): X of <root>.test3 declared in <root>'
|
||||
RETURN type=kotlin.Nothing from='public final fun test3 <X> (a: X of <root>.test3): {X of <root>.test3 & Any} declared in <root>'
|
||||
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): T0 of kotlin.internal.ir.CHECK_NOT_NULL declared in kotlin.internal.ir' type=X of <root>.test3 origin=EXCLEXCL
|
||||
<T0>: X of <root>.test3
|
||||
arg0: GET_VAR 'a: X of <root>.test3 declared in <root>.test3' type=X of <root>.test3 origin=null
|
||||
|
||||
+2
-1
@@ -12,7 +12,7 @@ fun test2(a: Any?): Int {
|
||||
})
|
||||
}
|
||||
|
||||
fun <X : Any?> test3(a: X): X {
|
||||
fun <X : Any?> test3(a: X): (X & Any) {
|
||||
return CHECK_NOT_NULL<X>(arg0 = a)
|
||||
}
|
||||
|
||||
@@ -27,3 +27,4 @@ fun <X : Any?> test4(a: X) {
|
||||
a is String? -> useString(s = CHECK_NOT_NULL<X>(arg0 = a) /*as String */)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
FILE fqName:<root> fileName:/implicitCastToNonNull.kt
|
||||
FUN name:test1 visibility:public modality:FINAL <> (x:kotlin.String?) returnType:kotlin.Int
|
||||
VALUE_PARAMETER name:x index:0 type:kotlin.String?
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun test1 (x: kotlin.String?): kotlin.Int declared in <root>'
|
||||
WHEN type=kotlin.Int origin=IF
|
||||
BRANCH
|
||||
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
|
||||
arg0: GET_VAR 'x: kotlin.String? declared in <root>.test1' type=kotlin.String? origin=null
|
||||
arg1: CONST Null type=kotlin.Nothing? value=null
|
||||
then: CONST Int type=kotlin.Int value=0
|
||||
BRANCH
|
||||
if: CONST Boolean type=kotlin.Boolean value=true
|
||||
then: CALL 'public open fun <get-length> (): kotlin.Int declared in kotlin.String' type=kotlin.Int origin=GET_PROPERTY
|
||||
$this: GET_VAR 'x: kotlin.String? declared in <root>.test1' type=kotlin.String? origin=null
|
||||
FUN name:test2 visibility:public modality:FINAL <T> (x:T of <root>.test2) returnType:kotlin.Int
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.CharSequence?]
|
||||
VALUE_PARAMETER name:x index:0 type:T of <root>.test2
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun test2 <T> (x: T of <root>.test2): kotlin.Int declared in <root>'
|
||||
WHEN type=kotlin.Int origin=IF
|
||||
BRANCH
|
||||
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
|
||||
arg0: GET_VAR 'x: T of <root>.test2 declared in <root>.test2' type=T of <root>.test2 origin=null
|
||||
arg1: CONST Null type=kotlin.Nothing? value=null
|
||||
then: CONST Int type=kotlin.Int value=0
|
||||
BRANCH
|
||||
if: CONST Boolean type=kotlin.Boolean value=true
|
||||
then: CALL 'public abstract fun <get-length> (): kotlin.Int declared in kotlin.CharSequence' type=kotlin.Int origin=GET_PROPERTY
|
||||
$this: GET_VAR 'x: T of <root>.test2 declared in <root>.test2' type=T of <root>.test2 origin=null
|
||||
FUN name:test3 visibility:public modality:FINAL <T> (x:kotlin.Any) returnType:kotlin.Int [inline]
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.CharSequence?]
|
||||
VALUE_PARAMETER name:x index:0 type:kotlin.Any
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun test3 <T> (x: kotlin.Any): kotlin.Int [inline] declared in <root>'
|
||||
WHEN type=kotlin.Int origin=IF
|
||||
BRANCH
|
||||
if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=T of <root>.test3
|
||||
GET_VAR 'x: kotlin.Any declared in <root>.test3' type=kotlin.Any origin=null
|
||||
then: CONST Int type=kotlin.Int value=0
|
||||
BRANCH
|
||||
if: CONST Boolean type=kotlin.Boolean value=true
|
||||
then: CALL 'public abstract fun <get-length> (): kotlin.Int declared in kotlin.CharSequence' type=kotlin.Int origin=GET_PROPERTY
|
||||
$this: TYPE_OP type={T of <root>.test3 & Any} origin=IMPLICIT_CAST typeOperand={T of <root>.test3 & Any}
|
||||
GET_VAR 'x: kotlin.Any declared in <root>.test3' type=kotlin.Any origin=null
|
||||
FUN name:test4 visibility:public modality:FINAL <T> (x:kotlin.Any?) returnType:kotlin.Int [inline]
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.CharSequence]
|
||||
VALUE_PARAMETER name:x index:0 type:kotlin.Any?
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun test4 <T> (x: kotlin.Any?): kotlin.Int [inline] declared in <root>'
|
||||
WHEN type=kotlin.Int origin=IF
|
||||
BRANCH
|
||||
if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=T of <root>.test4
|
||||
GET_VAR 'x: kotlin.Any? declared in <root>.test4' type=kotlin.Any? origin=null
|
||||
then: CONST Int type=kotlin.Int value=0
|
||||
BRANCH
|
||||
if: CONST Boolean type=kotlin.Boolean value=true
|
||||
then: CALL 'public abstract fun <get-length> (): kotlin.Int declared in kotlin.CharSequence' type=kotlin.Int origin=GET_PROPERTY
|
||||
$this: TYPE_OP type=T of <root>.test4 origin=IMPLICIT_CAST typeOperand=T of <root>.test4
|
||||
GET_VAR 'x: kotlin.Any? declared in <root>.test4' type=kotlin.Any? origin=null
|
||||
FUN name:test5 visibility:public modality:FINAL <T, S> (x:T of <root>.test5, fn:kotlin.Function1<S of <root>.test5, kotlin.Unit>) returnType:kotlin.Unit
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[S of <root>.test5?]
|
||||
TYPE_PARAMETER name:S index:1 variance: superTypes:[kotlin.Any?]
|
||||
VALUE_PARAMETER name:x index:0 type:T of <root>.test5
|
||||
VALUE_PARAMETER name:fn index:1 type:kotlin.Function1<S of <root>.test5, kotlin.Unit>
|
||||
BLOCK_BODY
|
||||
WHEN type=kotlin.Unit origin=IF
|
||||
BRANCH
|
||||
if: CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ
|
||||
$this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ
|
||||
arg0: GET_VAR 'x: T of <root>.test5 declared in <root>.test5' type=T of <root>.test5 origin=null
|
||||
arg1: CONST Null type=kotlin.Nothing? value=null
|
||||
then: CALL 'public abstract fun invoke (p1: P1 of kotlin.Function1): R of kotlin.Function1 [operator] declared in kotlin.Function1' type=kotlin.Unit origin=INVOKE
|
||||
$this: GET_VAR 'fn: kotlin.Function1<S of <root>.test5, kotlin.Unit> declared in <root>.test5' type=kotlin.Function1<S of <root>.test5, kotlin.Unit> origin=VARIABLE_AS_FUNCTION
|
||||
p1: GET_VAR 'x: T of <root>.test5 declared in <root>.test5' type=T of <root>.test5 origin=null
|
||||
@@ -1,33 +0,0 @@
|
||||
fun test1(x: String?): Int {
|
||||
return when {
|
||||
EQEQ(arg0 = x, arg1 = null) -> 0
|
||||
else -> x.<get-length>()
|
||||
}
|
||||
}
|
||||
|
||||
fun <T : CharSequence?> test2(x: T): Int {
|
||||
return when {
|
||||
EQEQ(arg0 = x, arg1 = null) -> 0
|
||||
else -> x.<get-length>()
|
||||
}
|
||||
}
|
||||
|
||||
inline fun <reified T : CharSequence?> test3(x: Any): Int {
|
||||
return when {
|
||||
x !is T -> 0
|
||||
else -> x /*as (T & Any) */.<get-length>()
|
||||
}
|
||||
}
|
||||
|
||||
inline fun <reified T : CharSequence> test4(x: Any?): Int {
|
||||
return when {
|
||||
x !is T -> 0
|
||||
else -> x /*as T */.<get-length>()
|
||||
}
|
||||
}
|
||||
|
||||
fun <T : S?, S : Any?> test5(x: T, fn: Function1<S, Unit>) {
|
||||
when {
|
||||
EQEQ(arg0 = x, arg1 = null).not() -> fn.invoke(p1 = x)
|
||||
}
|
||||
}
|
||||
@@ -41,7 +41,7 @@ FILE fqName:<root> fileName:/implicitCastToNonNull.kt
|
||||
BRANCH
|
||||
if: CONST Boolean type=kotlin.Boolean value=true
|
||||
then: CALL 'public abstract fun <get-length> (): kotlin.Int declared in kotlin.CharSequence' type=kotlin.Int origin=GET_PROPERTY
|
||||
$this: TYPE_OP type=T of <root>.test3 origin=IMPLICIT_CAST typeOperand=T of <root>.test3
|
||||
$this: TYPE_OP type={T of <root>.test3 & Any} origin=IMPLICIT_CAST typeOperand={T of <root>.test3 & Any}
|
||||
GET_VAR 'x: kotlin.Any declared in <root>.test3' type=kotlin.Any origin=null
|
||||
FUN name:test4 visibility:public modality:FINAL <T> (x:kotlin.Any?) returnType:kotlin.Int [inline]
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.CharSequence]
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
fun test1(x: String?) =
|
||||
if (x == null) 0 else x.length
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ fun <T : CharSequence?> test2(x: T): Int {
|
||||
inline fun <reified T : CharSequence?> test3(x: Any): Int {
|
||||
return when {
|
||||
x !is T -> 0
|
||||
else -> x /*as T */.<get-length>()
|
||||
else -> x /*as (T & Any) */.<get-length>()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,3 +31,4 @@ fun <T : S?, S : Any?> test5(x: T, fn: Function1<S, Unit>) {
|
||||
EQEQ(arg0 = x, arg1 = null).not() -> fn.invoke(p1 = x)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,4 +28,5 @@ FILE fqName:<root> fileName:/simpleUnaryOperators.kt
|
||||
FUN name:test6 visibility:public modality:FINAL <> () returnType:kotlin.Boolean
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun test6 (): kotlin.Boolean declared in <root>'
|
||||
CONST Boolean type=kotlin.Boolean value=false
|
||||
CALL 'public final fun not (): kotlin.Boolean [operator] declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCL
|
||||
$this: CONST Boolean type=kotlin.Boolean value=true
|
||||
|
||||
@@ -19,5 +19,6 @@ fun test5(x: Boolean): Boolean {
|
||||
}
|
||||
|
||||
fun test6(): Boolean {
|
||||
return false
|
||||
return true.not()
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ FILE fqName:<root> fileName:/intersectionType1.kt
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun foo <T> (a: kotlin.Array<<root>.In<T of <root>.foo>>, b: kotlin.Array<<root>.In<kotlin.String>>): kotlin.Boolean declared in <root>'
|
||||
CALL 'public final fun ofType <K> (y: kotlin.Any?): kotlin.Boolean [inline] declared in <root>' type=kotlin.Boolean origin=null
|
||||
<K>: kotlin.Any?
|
||||
<K>: kotlin.Any
|
||||
$receiver: CALL 'public final fun get (index: kotlin.Int): T of kotlin.Array [operator] declared in kotlin.Array' type=<root>.In<kotlin.Nothing> origin=null
|
||||
$this: CALL 'public final fun select <S> (x: S of <root>.select, y: S of <root>.select): S of <root>.select declared in <root>' type=kotlin.Array<out <root>.In<kotlin.Nothing>> origin=null
|
||||
<S>: kotlin.Array<out <root>.In<kotlin.Nothing>>
|
||||
|
||||
@@ -12,7 +12,7 @@ fun <S : Any?> select(x: S, y: S): S {
|
||||
}
|
||||
|
||||
fun <T : Any?> foo(a: Array<In<T>>, b: Array<In<String>>): Boolean {
|
||||
return select<Array<out In<Nothing>>>(x = a, y = b).get(index = 0).ofType<Any?>(y = true)
|
||||
return select<Array<out In<Nothing>>>(x = a, y = b).get(index = 0).ofType<Any>(y = true)
|
||||
}
|
||||
|
||||
inline fun <reified K : Any?> In<K>.ofType(y: Any?): Boolean {
|
||||
@@ -24,3 +24,4 @@ fun test() {
|
||||
val a2: Array<In<String>> = arrayOf<In<String>>(elements = [In<String>()])
|
||||
foo<Int>(a = a1, b = a2) /*~> Unit */
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user