[kotlin] Update test data after bundling new Kotlin JPS plug-in

The main issue here is that in tests we are using stdlib from the default JPS (KTIJ-21822) and a lot of tests infer language version based on a stdlib version. As a result, a lot of tests changed because of switching LV from 1.6 to 1.7.

GitOrigin-RevId: 0eed6052bebcd53e2cb55daac7aad4a905bcc266
This commit is contained in:
Mikhail Zarechenskiy
2022-05-30 20:27:42 +00:00
committed by intellij-monorepo-bot
parent 65f2819253
commit 6bb2e4f62d
66 changed files with 71 additions and 50 deletions
@@ -6,9 +6,7 @@ fun <T: Any, E> T.foo(<warning descr="[UNUSED_PARAMETER] Parameter 'x' is never
y plus 1
y + 1.0
this<warning descr="[SAFE_CALL_WILL_CHANGE_NULLABILITY] Safe call on a non-null receiver will have nullable type in future releases
Right now safe call on non nullable receiver has not null type: `\"hello\"?.length` has type Int
In future releases all safe calls will have nullable type: `\"hello\"?.length` will have type Int?"><warning descr="[UNNECESSARY_SAFE_CALL] Unnecessary safe call on a non-null receiver of type T">?.</warning>minus<T>(this)</warning>
this<warning descr="[UNNECESSARY_SAFE_CALL] Unnecessary safe call on a non-null receiver of type T">?.</warning>minus<T>(this)
return this
}
@@ -66,9 +64,7 @@ fun Int.foo() = this
command?.equals1(null)
val c = Command()
c<warning descr="[SAFE_CALL_WILL_CHANGE_NULLABILITY] Safe call on a non-null receiver will have nullable type in future releases
Right now safe call on non nullable receiver has not null type: `\"hello\"?.length` has type Int
In future releases all safe calls will have nullable type: `\"hello\"?.length` will have type Int?"><warning descr="[UNNECESSARY_SAFE_CALL] Unnecessary safe call on a non-null receiver of type Command">?.</warning>equals2(null)</warning>
c<warning descr="[UNNECESSARY_SAFE_CALL] Unnecessary safe call on a non-null receiver of type Command">?.</warning>equals2(null)
if (command == null) <warning descr="[UNUSED_EXPRESSION] The expression is unused">1</warning>
}
@@ -27,7 +27,7 @@ fun nonExhaustiveNullable(c: Color?) = <error descr="[NO_ELSE_IN_WHEN] 'when' ex
}
fun whenOnEnum(c: Color) {
<warning descr="[NON_EXHAUSTIVE_WHEN_STATEMENT] Non exhaustive 'when' statements on enum will be prohibited in 1.7, add 'RED' branch or 'else' branch instead">when</warning>(c) {
<error descr="[NO_ELSE_IN_WHEN] 'when' expression must be exhaustive, add necessary 'RED' branch or 'else' branch instead">when</error>(c) {
Color.BLUE -> {}
Color.GREEN -> {}
}
@@ -60,6 +60,6 @@ fun nonExhaustiveNullableSealed(v: Variant?) = <error descr="[NO_ELSE_IN_WHEN] '
sealed class Empty
fun nonExhaustiveEmpty(e: Empty) = <error descr="[NO_ELSE_IN_WHEN] 'when' expression must be exhaustive, add necessary 'else' branch">when</error>(<warning>e</warning>) {}
fun nonExhaustiveEmpty(e: Empty) = <error descr="[NO_ELSE_IN_WHEN] 'when' expression must be exhaustive, add necessary 'else' branch">when</error>(<warning descr="[UNUSED_EXPRESSION] The expression is unused">e</warning>) {}
fun nonExhaustiveNullableEmpty(e: Empty?) = <error descr="[NO_ELSE_IN_WHEN] 'when' expression must be exhaustive, add necessary 'else' branch">when</error>(<warning>e</warning>) {}
fun nonExhaustiveNullableEmpty(e: Empty?) = <error descr="[NO_ELSE_IN_WHEN] 'when' expression must be exhaustive, add necessary 'else' branch">when</error>(<warning descr="[UNUSED_EXPRESSION] The expression is unused">e</warning>) {}
@@ -6,8 +6,6 @@ fun main(<warning descr="[UNUSED_PARAMETER] Parameter 'args' is never used">args
val command : Any = 1
command<warning descr="[SAFE_CALL_WILL_CHANGE_NULLABILITY] Safe call on a non-null receiver will have nullable type in future releases
Right now safe call on non nullable receiver has not null type: `\"hello\"?.length` has type Int
In future releases all safe calls will have nullable type: `\"hello\"?.length` will have type Int?"><warning descr="[UNNECESSARY_SAFE_CALL] Unnecessary safe call on a non-null receiver of type Any">?.</warning>equals(null)</warning>
command<warning descr="[UNNECESSARY_SAFE_CALL] Unnecessary safe call on a non-null receiver of type Any">?.</warning>equals(null)
command.equals(null)
}
@@ -67,45 +67,44 @@ val x = C() willBeInfix 1
fun bar(yield: Int = 4) {}
fun yield(yield: Int) {
"$`yield`"
"${`yield`}"
"$yield"
"${yield}"
`yield`
val foo = `yield` + `yield`
val foo2 = `yield`
yield
val foo = yield + yield
val foo2 = yield
// bar(yield = 5) //this is different in old and new inference, should be tested in compiler
yield(4)
yield() {}
yield {}
class yield<T: `yield`<T>>
class yield<T: yield<T>>
return@`yield`
return@`yield` Unit
return@yield
return@yield Unit
val foo5: `yield`<*>
val foo5: yield<*>
}
fun yield(i: (Int) -> Unit) {}
annotation class yield
@`yield`()
@yield()
fun test2(p: Int) {
`yield`@ p
yield@ p
@`yield`
fun f() {}
@yield fun f() {}
}
object X {
fun yield() {}
fun test3(yield: Int) {
X::`yield`
X::yield
`yield`::toInt
yield::toInt
}
}
@@ -92,7 +92,7 @@ fun atLeastOnce() {
if (<warning descr="Condition 'x == 2' is always true">x == 2</warning>) {}
}
@<warning descr="[OPT_IN_IS_NOT_ENABLED] This annotation should be used with the compiler argument '-opt-in=kotlin.RequiresOptIn'">OptIn</warning>(kotlin.contracts.ExperimentalContracts::class)
@OptIn(kotlin.contracts.ExperimentalContracts::class)
inline fun runAtLeastOnce(lambda: () -> Unit) {
contract {
callsInPlace(lambda, InvocationKind.AT_LEAST_ONCE)
@@ -1,5 +1,6 @@
// PROBLEM: none
// WITH_STDLIB
// ERROR: Type mismatch: inferred type is Int? but Int was expected
val x = 1
val y = x.<caret>let { it + it?.hashCode() }
@@ -1,3 +1,4 @@
// ERROR: 'when' expression must be exhaustive, add necessary 'C' branch or 'else' branch instead
// PROBLEM: none
enum class TestEnum{
@@ -1,3 +1,4 @@
// ERROR: 'when' expression must be exhaustive, add necessary 'C' branch or 'else' branch instead
// ERROR: A 'return' expression required in a function with a block body ('{...}')
// PROBLEM: none
@@ -8,7 +8,7 @@ abstract class A {
class B : A() {
override fun a() = doIt {
1.let { it.let { it.let { it.let { it?.doDo() } } } }
1.let { it.let { it.let { it.let { it.doDo() } } } }
Unit<caret>
}
}
@@ -8,7 +8,7 @@ abstract class A {
class B : A() {
override fun a() = doIt {
1.let { it.let { it.let { it.let { it?.doDo() } } } }
1.let { it.let { it.let { it.let { it.doDo() } } } }
}
}
@@ -1,5 +1,6 @@
// PROBLEM: none
// WITH_STDLIB
// ERROR: Type mismatch: inferred type is Int? but Int was expected
val x = 1
val y = x.<caret>let { it + it?.hashCode() }
@@ -1,3 +1,4 @@
// ERROR: 'when' expression must be exhaustive, add necessary 'RW' branch or 'else' branch instead
// PROBLEM: none
enum class AccessMode { READ, WRITE, RW }
@@ -1,3 +1,4 @@
// ERROR: 'when' expression must be exhaustive, add necessary 'RW' branch or 'else' branch instead
// PROBLEM: none
enum class AccessMode { READ, WRITE, RW }
@@ -1,3 +1,4 @@
// ERROR: 'when' expression must be exhaustive, add necessary 'RW' branch or 'else' branch instead
// IS_APPLICABLE: true
enum class AccessMode { READ, WRITE, RW }
fun <T> run(f: () -> T) = f()
@@ -1,3 +1,4 @@
// ERROR: 'when' expression must be exhaustive, add necessary 'RW' branch or 'else' branch instead
// IS_APPLICABLE: true
enum class AccessMode { READ, WRITE, RW }
fun <T> run(f: () -> T) = f()
@@ -1,3 +1,4 @@
// ERROR: 'when' expression must be exhaustive, add necessary 'RW' branch or 'else' branch instead
// PROBLEM: none
enum class AccessMode { READ, WRITE, RW }
@@ -1,3 +1,4 @@
// ERROR: 'when' expression must be exhaustive, add necessary 'false' branch or 'else' branch instead
// PROBLEM: none
enum class AccessMode { READ, WRITE, RW }
@@ -1,3 +1,4 @@
// SKIP_ERRORS_BEFORE
// WITH_STDLIB
enum class Entry {
@@ -1,3 +1,4 @@
// SKIP_ERRORS_BEFORE
// WITH_STDLIB
enum class Entry {
@@ -1,4 +1,5 @@
// WITH_STDLIB
// SKIP_ERRORS_BEFORE
enum class Entry {
FOO, BAR, BAZ
@@ -1,4 +1,5 @@
// WITH_STDLIB
// SKIP_ERRORS_BEFORE
enum class Entry {
FOO, BAR, BAZ
@@ -1,3 +1,4 @@
// SKIP_ERRORS_BEFORE
// AFTER-WARNING: The expression is unused
// AFTER-WARNING: The expression is unused
fun foo(i : Int) {
@@ -1,3 +1,4 @@
// SKIP_ERRORS_BEFORE
// AFTER-WARNING: The expression is unused
// AFTER-WARNING: The expression is unused
fun foo(i : Int) {
@@ -1,5 +1,4 @@
// AFTER-WARNING: Parameter 'args' is never used
// AFTER-WARNING: Safe call on a non-null receiver will have nullable type in future releases<br> Right now safe call on non nullable receiver has not null type: `"hello"?.length` has type Int<br> In future releases all safe calls will have nullable type: `"hello"?.length` will have type Int?
// AFTER-WARNING: Unnecessary safe call on a non-null receiver of type B?
// AFTER-WARNING: Variable 'x' is never used
class B {
@@ -1,5 +1,4 @@
// AFTER-WARNING: Parameter 'args' is never used
// AFTER-WARNING: Safe call on a non-null receiver will have nullable type in future releases<br> Right now safe call on non nullable receiver has not null type: `"hello"?.length` has type Int<br> In future releases all safe calls will have nullable type: `"hello"?.length` will have type Int?
// AFTER-WARNING: Unnecessary safe call on a non-null receiver of type B?
// AFTER-WARNING: Variable 'x' is never used
class B {
@@ -1,6 +1,5 @@
// INTENTION_TEXT: "Convert to 'reduceIndexedOrNull'"
// WITH_STDLIB
// AFTER-WARNING: This annotation should be used with the compiler argument '-opt-in=kotlin.RequiresOptIn'
// TODO: fix warning?
// AFTER-WARNING: Parameter 'index' is never used, could be renamed to _
@OptIn(ExperimentalStdlibApi::class)
@@ -1,6 +1,5 @@
// INTENTION_TEXT: "Convert to 'reduceIndexedOrNull'"
// WITH_STDLIB
// AFTER-WARNING: This annotation should be used with the compiler argument '-opt-in=kotlin.RequiresOptIn'
// TODO: fix warning?
// AFTER-WARNING: Parameter 'index' is never used, could be renamed to _
@OptIn(ExperimentalStdlibApi::class)
@@ -1,6 +1,5 @@
// INTENTION_TEXT: "Convert to 'reduceRightIndexedOrNull'"
// WITH_STDLIB
// AFTER-WARNING: This annotation should be used with the compiler argument '-opt-in=kotlin.RequiresOptIn'
// TODO: fix warning?
// AFTER-WARNING: Parameter 'index' is never used, could be renamed to _
@OptIn(ExperimentalStdlibApi::class)
@@ -1,6 +1,5 @@
// INTENTION_TEXT: "Convert to 'reduceRightIndexedOrNull'"
// WITH_STDLIB
// AFTER-WARNING: This annotation should be used with the compiler argument '-opt-in=kotlin.RequiresOptIn'
// TODO: fix warning?
// AFTER-WARNING: Parameter 'index' is never used, could be renamed to _
@OptIn(ExperimentalStdlibApi::class)
@@ -1,6 +1,5 @@
// INTENTION_TEXT: "Convert to 'runningReduceIndexed'"
// WITH_STDLIB
// AFTER-WARNING: This annotation should be used with the compiler argument '-opt-in=kotlin.RequiresOptIn'
// TODO: fix warning?
// AFTER-WARNING: Parameter 'index' is never used, could be renamed to _
@OptIn(ExperimentalStdlibApi::class)
@@ -1,6 +1,5 @@
// INTENTION_TEXT: "Convert to 'runningReduceIndexed'"
// WITH_STDLIB
// AFTER-WARNING: This annotation should be used with the compiler argument '-opt-in=kotlin.RequiresOptIn'
// TODO: fix warning?
// AFTER-WARNING: Parameter 'index' is never used, could be renamed to _
@OptIn(ExperimentalStdlibApi::class)
@@ -1,6 +1,5 @@
// INTENTION_TEXT: "Convert to 'scanIndexed'"
// WITH_STDLIB
// AFTER-WARNING: This annotation should be used with the compiler argument '-opt-in=kotlin.RequiresOptIn'
// TODO: fix warning?
// AFTER-WARNING: Parameter 'index' is never used, could be renamed to _
@OptIn(ExperimentalStdlibApi::class)
@@ -1,6 +1,5 @@
// INTENTION_TEXT: "Convert to 'scanIndexed'"
// WITH_STDLIB
// AFTER-WARNING: This annotation should be used with the compiler argument '-opt-in=kotlin.RequiresOptIn'
// TODO: fix warning?
// AFTER-WARNING: Parameter 'index' is never used, could be renamed to _
@OptIn(ExperimentalStdlibApi::class)
@@ -1,7 +1,6 @@
// INTENTION_TEXT: "Convert to 'runningReduceIndexed'"
// WITH_STDLIB
// DISABLE-ERRORS
// AFTER-WARNING: This annotation should be used with the compiler argument '-opt-in=kotlin.RequiresOptIn'
// TODO: fix warning?
// AFTER-WARNING: Parameter 'index' is never used, could be renamed to _
@OptIn(ExperimentalStdlibApi::class)
@@ -1,7 +1,6 @@
// INTENTION_TEXT: "Convert to 'runningReduceIndexed'"
// WITH_STDLIB
// DISABLE-ERRORS
// AFTER-WARNING: This annotation should be used with the compiler argument '-opt-in=kotlin.RequiresOptIn'
// TODO: fix warning?
// AFTER-WARNING: Parameter 'index' is never used, could be renamed to _
@OptIn(ExperimentalStdlibApi::class)
@@ -1,5 +1,6 @@
// "Create class 'Foo'" "true"
// ERROR: Unresolved reference: Foo
// ERROR: 'public' property exposes its 'public/*package*/' type B
class A<T> internal constructor(val b: B<T>) {
internal fun test() = B.Foo<Int, String>(2, "2")
@@ -1,5 +1,6 @@
// "Create class 'Foo'" "true"
// ERROR: Unresolved reference: Foo
// ERROR: 'public' property exposes its 'public/*package*/' type B
class A<T> internal constructor(val b: B<T>) {
internal fun test() = B.<caret>Foo<Int, String>(2, "2")
@@ -1,5 +1,6 @@
// "Create class 'Foo'" "true"
// ERROR: Unresolved reference: Foo
// ERROR: 'public' property exposes its 'public/*package*/' type B
class A<T> internal constructor(val b: B<T>) {
internal fun test() = b.Foo<Int, String>(2, "2")
@@ -1,5 +1,6 @@
// "Create class 'Foo'" "true"
// ERROR: Unresolved reference: Foo
// ERROR: 'public' property exposes its 'public/*package*/' type B
class A<T> internal constructor(val b: B<T>) {
internal fun test() = b.<caret>Foo<Int, String>(2, "2")
@@ -1,5 +1,6 @@
// "Create class 'Foo'" "true"
// ERROR: Unresolved reference: Foo
// ERROR: 'public' property exposes its 'public/*package*/' type B
class A<T> internal constructor(val b: B<T>) {
internal fun test() = b.Foo<String>(2, "2")
@@ -1,5 +1,6 @@
// "Create class 'Foo'" "true"
// ERROR: Unresolved reference: Foo
// ERROR: 'public' property exposes its 'public/*package*/' type B
class A<T> internal constructor(val b: B<T>) {
internal fun test() = b.<caret>Foo<String>(2, "2")
@@ -1,5 +1,6 @@
// "Create class 'Foo'" "true"
// ERROR: Unresolved reference: Foo
// ERROR: 'public' property exposes its 'public/*package*/' type B
class A<T> internal constructor(val b: B<T>) {
internal fun test() = b.Foo<T, Int, String>(2, "2")
@@ -1,5 +1,6 @@
// "Create class 'Foo'" "true"
// ERROR: Unresolved reference: Foo
// ERROR: 'public' property exposes its 'public/*package*/' type B
class A<T> internal constructor(val b: B<T>) {
internal fun test() = b.<caret>Foo<T, Int, String>(2, "2")
@@ -1,5 +1,6 @@
// "Create class 'Foo'" "true"
// ERROR: Unresolved reference: Foo
// ERROR: 'public' property exposes its 'public/*package*/' type B
class A<T> internal constructor(val b: B<T>) {
internal fun test() = B.Foo<String>(2, "2")
@@ -1,5 +1,6 @@
// "Create class 'Foo'" "true"
// ERROR: Unresolved reference: Foo
// ERROR: 'public' property exposes its 'public/*package*/' type B
class A<T> internal constructor(val b: B<T>) {
internal fun test() = B.<caret>Foo<String>(2, "2")
@@ -1,5 +1,6 @@
// "Create member function 'B.foo'" "true"
// ERROR: Unresolved reference: foo
// ERROR: 'public' property exposes its 'public/*package*/' type B
class A<T> internal constructor(val b: B<T>) {
fun test(): Int {
@@ -1,5 +1,6 @@
// "Create member function 'B.foo'" "true"
// ERROR: Unresolved reference: foo
// ERROR: 'public' property exposes its 'public/*package*/' type B
class A<T> internal constructor(val b: B<T>) {
fun test(): Int {
@@ -1,5 +1,6 @@
// "Create member function 'B.foo'" "true"
// ERROR: Unresolved reference: foo
// ERROR: 'public' property exposes its 'public/*package*/' type B
class A<T> internal constructor(val b: B<T>) {
fun test(): Int {
@@ -1,5 +1,6 @@
// "Create member function 'B.foo'" "true"
// ERROR: Unresolved reference: foo
// ERROR: 'public' property exposes its 'public/*package*/' type B
class A<T> internal constructor(val b: B<T>) {
fun test(): Int {
@@ -1,5 +1,6 @@
// "Create member function 'B.foo'" "true"
// ERROR: Unresolved reference: foo
// ERROR: 'public' property exposes its 'public/*package*/' type B
class A<T> internal constructor(val b: B<T>) {
fun test(): Int {
@@ -1,5 +1,6 @@
// "Create member function 'B.foo'" "true"
// ERROR: Unresolved reference: foo
// ERROR: 'public' property exposes its 'public/*package*/' type B
class A<T> internal constructor(val b: B<T>) {
fun test(): Int {
@@ -4,7 +4,6 @@
// ACTION: Flip '>'
// ACTION: Replace '&&' with '||'
// ACTION: Replace overloaded operator with function call
// ACTION: Simplify boolean expression
// ERROR: Operator call corresponds to a dot-qualified call 'w?.x.compareTo(42)' which is not allowed on a nullable receiver 'w?.x'.
class Wrapper(val x: Int)
@@ -4,5 +4,5 @@ class Bar(val baz: Baz)
class Baz(val qux: Int)
fun test(foo: Foo) {
foo.bar.baz.qux
foo.bar?.baz?.qux
}
@@ -4,5 +4,5 @@ class Bar(val baz: Baz?)
class Baz(val qux: Int)
fun test(foo: Foo) {
foo.bar.baz?.qux
foo.bar?.baz?.qux
}
@@ -1,4 +1,5 @@
// "Surround with null check" "true"
// ERROR: 'when' expression must be exhaustive, add necessary 'false' branch or 'else' branch instead
fun foo(arg: Int?, flag: Boolean) {
when (flag) {
@@ -1,4 +1,5 @@
// "Surround with null check" "true"
// ERROR: 'when' expression must be exhaustive, add necessary 'false' branch or 'else' branch instead
fun foo(arg: Int?, flag: Boolean) {
when (flag) {
@@ -1,4 +1,5 @@
// "Add remaining branches" "true"
// ERROR: 'when' expression must be exhaustive, add necessary 'RED', 'GREEN', 'BLUE' branches or 'else' branch instead
package u
@@ -1,4 +1,5 @@
// "Add remaining branches" "true"
// ERROR: 'when' expression must be exhaustive, add necessary 'RED', 'GREEN', 'BLUE' branches or 'else' branch instead
package u
@@ -1,4 +1,5 @@
// "Add remaining branches with * import" "true"
// ERROR: 'when' expression must be exhaustive, add necessary 'RED', 'GREEN', 'BLUE' branches or 'else' branch instead
package u
@@ -1,4 +1,5 @@
// "Add remaining branches with * import" "true"
// ERROR: 'when' expression must be exhaustive, add necessary 'RED', 'GREEN', 'BLUE' branches or 'else' branch instead
package u
@@ -1,4 +1,5 @@
// "Add remaining branches" "false"
// ERROR: 'when' expression must be exhaustive, add necessary 'is B' branch or 'else' branch instead
// WITH_STDLIB
sealed class A
@@ -1,4 +1,5 @@
// "Wrap expression in parentheses" "true"
// ERROR: 'when' expression must be exhaustive, add necessary 'true', 'false' branches or 'else' branch instead
interface A {
operator fun contains(other: A): Boolean
}
@@ -1,4 +1,5 @@
// "Wrap expression in parentheses" "true"
// ERROR: 'when' expression must be exhaustive, add necessary 'true', 'false' branches or 'else' branch instead
interface A {
operator fun contains(other: A): Boolean
}
@@ -6,8 +6,8 @@ fun <T> mySeq(f: MySeq<T>.() -> Unit): MySeq<T> = null!!
class Test {
fun repro() = mySeq<Int> {
mySeq<Double> {
yield(1.0)
mySeq {
this.yield(1.0)
}
}
@@ -6,7 +6,7 @@ abstract class A {
}
fun foo<caret>() {
1.let { it.let { it.let { it.let { it?.doDo() } } } }
1.let { it.let { it.let { it.let { it.doDo() } } } }
}
class B : A() {
@@ -7,6 +7,6 @@ abstract class A {
class B : A() {
override fun a() = doIt {
1.let { it.let { it.let { it.let { it?.doDo() } } } }
1.let { it.let { it.let { it.let { it.doDo() } } } }
}
}