[K1, K2, CLI] Mark whole position range of compiler diagnostics in CLI

#KT-64989
This commit is contained in:
Evgeniy.Zhelenskiy
2024-01-15 21:36:56 +01:00
committed by Space Team
parent 5b11308d1b
commit 7eab4b672d
278 changed files with 929 additions and 907 deletions
@@ -6,7 +6,7 @@ import a.B.Companion.bar
^
/b.kt:37:12: error: cannot access 'Companion': it is private in 'C'
import a.C.Companion.baz
^
^^^^^^^^^
/b.kt:38:10: error: cannot access 'D': it is private in file
import a.D
^
@@ -15,7 +15,7 @@ import a.D.Companion.quux
^
/b.kt:39:12: error: cannot access 'Companion': it is private in 'D'
import a.D.Companion.quux
^
^^^^^^^^^
/b.kt:43:7: error: cannot access 'B': it is private in file
f(B)
^
@@ -30,17 +30,17 @@ import a.D.Companion.quux
^
/b.kt:48:7: error: cannot access 'B': it is private in file
B.bar()
^
^^^
/b.kt:49:7: error: cannot access 'Companion': it is private in 'C'
C.baz()
^
^^^
/b.kt:50:5: error: cannot access 'D': it is private in file
D.quux()
^
/b.kt:50:7: error: cannot access 'Companion': it is private in 'D'
D.quux()
^
^^^^
/b.kt:53:9: error: cannot access 'Companion': it is private in 'C'
a.C.baz()
^
^^^
@@ -3,11 +3,11 @@ fun test(c: C) {
^
/deprecatedError.kt:15:5: error: using 'foo(String): Unit' is an error. alas
foo("")
^
^^^
/deprecatedError.kt:16:5: error: using 'C' is an error. alas
C()
^
/deprecatedError.kt:17:5: error: using 'bar: Int' is an error. alas
bar
^
^^^
@@ -1,5 +1,6 @@
/contextReceiverAmbiguity.kt:13:9: error: overload resolution ambiguity:
/contextReceiverAmbiguity.kt:13:9: error: overload resolution ambiguity:
context(String) public fun foo(x: Comparable<*>): Unit defined in root package in file contextReceiverAmbiguity.kt
context(String) public fun foo(x: Number): Unit defined in root package in file contextReceiverAmbiguity.kt
foo(1)
^
^^^
@@ -1,3 +1,4 @@
/test.kt:26:9: warning: ambiguous access to property 'first.KtNodeTypes.SOME' is deprecated because similar enum entry 'second.SomeEnum.SOME' is available. Please add explicit named import or use fully qualified name
SOME -> true
^
^^^^
@@ -1,3 +1,4 @@
/test.kt:26:9: warning: ambiguous access to property 'first.KtNodeTypes.SOME' is deprecated because similar enum entry 'second.SomeEnum.SOME' is available. Please add explicit named import or use fully qualified name
SOME -> true
^
^^^^
@@ -1,4 +1,4 @@
/kt47986Default.kt:9:13: warning: type parameter for a type argument K can't be inferred into declared upper bounds. Please provide any use-site type information. It will become an error in future releases.
val x = buildFoo {
^
^^^^^^^^
@@ -1,4 +1,4 @@
/kt47986Disabled.kt:10:13: warning: type parameter for a type argument K can't be inferred into declared upper bounds. Please provide any use-site type information. It will become an error in future releases.
val x = buildFoo {
^
^^^^^^^^
@@ -1,4 +1,4 @@
/kt47986_2.kt:11:13: warning: type parameter for a type argument K can't be inferred into declared upper bounds. Please provide any use-site type information. It will become an error in future releases.
val x = buildFoo { // can't infer
^
^^^^^^^^
@@ -1,4 +1,4 @@
/kt47986_3.kt:9:13: warning: type parameter for a type argument K can't be inferred into declared upper bounds. Please provide any use-site type information. It will become an error in future releases.
val x = buildFoo {
^
^^^^^^^^
@@ -1,4 +1,4 @@
/kt51464.kt:12:15: warning: type parameter for a type argument R can't be inferred into declared upper bounds. Please provide any use-site type information. It will become an error in future releases.
flowOf(1).transform { doEmit(this) }
^
^^^^^^^^^
@@ -1,4 +1,4 @@
/kt45461.kt:12:19: warning: type argument for a type parameter S can't be inferred because it has incompatible upper bounds: String, Int (multiple incompatible classes). This will become an error in Kotlin 2.0
Bar<String>().takeFoo(foo) // error in 1.3.72, no error in 1.4.31
^
^^^^^^^
@@ -1,4 +1,4 @@
/kt45461_12.kt:14:19: warning: type argument for a type parameter S can't be inferred because it has incompatible upper bounds: String, K (multiple incompatible classes: String, Number). This will become an error in Kotlin 2.0
Bar<String>().takeFoo(foo) // error in 1.3.72, no error in 1.4.31
^
^^^^^^^
@@ -1,7 +1,7 @@
/kt45461_2.kt:10:10: warning: 'Int' is a final type, and thus a value of the type parameter is predetermined
fun <K : Int> main() {
^
^^^
/kt45461_2.kt:12:19: warning: type argument for a type parameter S can't be inferred because it has incompatible upper bounds: String, K (multiple incompatible classes: String, Int). This will become an error in Kotlin 2.0
Bar<String>().takeFoo(foo) // error in 1.3.72, no error in 1.4.31
^
^^^^^^^
@@ -1,10 +1,10 @@
/kt45461_25.kt:11:20: error: type mismatch: inferred type is {K & String} but Float was expected
val x: Float = Bar<String>().takeFoo(foo) // error in 1.3.72, no error in 1.4.31
^
^^^^^^^^^^^^^^^^^^^^^^^^^^
/kt45461_25.kt:11:34: error: type argument for a type parameter S can't be inferred because it has incompatible upper bounds: String, K (multiple incompatible classes: String, Int)
val x: Float = Bar<String>().takeFoo(foo) // error in 1.3.72, no error in 1.4.31
^
^^^^^^^
/kt45461_25.kt:11:34: error: type mismatch: inferred type is {K & String} but Float was expected
val x: Float = Bar<String>().takeFoo(foo) // error in 1.3.72, no error in 1.4.31
^
^^^^^^^
@@ -1,6 +1,7 @@
/kt45461_26.kt:13:25: error: type mismatch: inferred type is {K & Out<String>} but Out<Float> was expected
val x: Out<Float> = Bar<Out<String>>().takeFoo(foo)
^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/kt45461_26.kt:13:44: error: type mismatch: inferred type is {K & Out<String>} but Out<Float> was expected
val x: Out<Float> = Bar<Out<String>>().takeFoo(foo)
^
^^^^^^^
@@ -1,4 +1,4 @@
/kt45461_5.kt:12:19: warning: type argument for a type parameter S can't be inferred because it has incompatible upper bounds: String, K (multiple incompatible classes: String, Number). This will become an error in Kotlin 2.0
Bar<String>().takeFoo(foo) // error in 1.3.72, no error in 1.4.31
^
^^^^^^^
@@ -1,10 +1,10 @@
/kt48765.kt:10:13: warning: type argument for a type parameter T can't be inferred because it has incompatible upper bounds: String, Number (multiple incompatible classes). This will become an error in Kotlin 2.0
B().foo(x, foo())
^
^^^
/kt48765.kt:14:9: warning: 'String' is a final type, and thus a value of the type parameter is predetermined
fun <T: String> foo(): T {
^
^^^^^^
/kt48765.kt:15:15: warning: unchecked cast: String to T
return "" as T // this cast is safe because String is final.
^
^^^^
@@ -1,4 +1,4 @@
/kt48935.kt:13:5: warning: type argument for a type parameter T has possible incompatible upper bounds: Base, DoesNotImplementBase (final class and interface)
exampleGenericFunction(func) // expected this to be a compilation error as the T: Base constraint should not be satisfied
^
^^^^^^^^^^^^^^^^^^^^^^
@@ -1,4 +1,4 @@
/selectFromCovariantAndContravariantTypes.kt:17:5: warning: type argument for a type parameter V can't be inferred because it has incompatible upper bounds: A, B (multiple incompatible classes). This will become an error in Kotlin 2.0
genericIn(select(a, b))
^
^^^^^^^^^
@@ -1,6 +1,7 @@
/kt55179.kt:16:5: error: non-private inline function cannot access members of private classes: 'public constructor Foo() defined in Foo'
Foo()
^
^^^
/kt55179.kt:17:9: error: non-private inline function cannot access members of private classes: 'public companion object defined in Foo'
Foo.Companion
^
^^^^^^^^^
@@ -1,15 +1,16 @@
/main.kt:22:11: warning: type parameter 'V' has nullable upper bounds while non-nullable version is expected. This warning will become an error soon. See https://youtrack.jetbrains.com/issue/KT-36770 for details
takeV(value)
^
^^^^^
/main.kt:23:15: warning: type parameter 'V' has nullable upper bounds while non-nullable version is expected. This warning will become an error soon. See https://youtrack.jetbrains.com/issue/KT-36770 for details
takeVList(l)
^
/main.kt:25:11: warning: type parameter 'V' has nullable upper bounds while non-nullable version is expected. This warning will become an error soon. See https://youtrack.jetbrains.com/issue/KT-36770 for details
takeE(value)
^
^^^^^
/main.kt:26:15: warning: type parameter 'V' has nullable upper bounds while non-nullable version is expected. This warning will become an error soon. See https://youtrack.jetbrains.com/issue/KT-36770 for details
takeEList(l)
^
/main.kt:27:11: warning: type parameter 'V' has nullable upper bounds while non-nullable version is expected. This warning will become an error soon. See https://youtrack.jetbrains.com/issue/KT-36770 for details
takeE(id(value))
^
^^^^^^^^^
@@ -1,13 +1,13 @@
/main.kt:23:5: warning: type parameter 'X' has nullable upper bound, so override has incorrect signature comparing with a base member with NotNull annotation. Please add a non-nullable upper bound (e.g. Any) to the type parameter. See https://kotlinlang.org/docs/generics.html#upper-bounds and https://youtrack.jetbrains.com/issue/KT-36770 for more details. This warning will become an error soon.
override fun takeV(x: X)
^
^^^^^^^^
/main.kt:24:5: warning: type parameter 'E1' has nullable upper bound, so override has incorrect signature comparing with a base member with NotNull annotation. Please add a non-nullable upper bound (e.g. Any) to the type parameter. See https://kotlinlang.org/docs/generics.html#upper-bounds and https://youtrack.jetbrains.com/issue/KT-36770 for more details. This warning will become an error soon.
override fun <E1> takeE(e: E1)
^
^^^^^^^^
/main.kt:26:5: warning: type parameter 'X' has nullable upper bound, so override has incorrect signature comparing with a base member with NotNull annotation. Please add a non-nullable upper bound (e.g. Any) to the type parameter. See https://kotlinlang.org/docs/generics.html#upper-bounds and https://youtrack.jetbrains.com/issue/KT-36770 for more details. This warning will become an error soon.
override fun takeVList(l: List<X>)
^
^^^^^^^^
/main.kt:27:5: warning: type parameter 'E2' has nullable upper bound, so override has incorrect signature comparing with a base member with NotNull annotation. Please add a non-nullable upper bound (e.g. Any) to the type parameter. See https://kotlinlang.org/docs/generics.html#upper-bounds and https://youtrack.jetbrains.com/issue/KT-36770 for more details. This warning will become an error soon.
override fun <E2> takeEList(l2: List<E2>)
^
^^^^^^^^
+2 -1
View File
@@ -7,4 +7,5 @@
// -- Module: <m4> --
/Call.kt:90:19: error: unresolved reference: result
fun simple(b: com.result.B<*>) {}
^
^^^^^^
@@ -5,5 +5,5 @@
// -- Module: <m3> --
/m3.kt:24:17: error: unresolved reference: Some
foo { some: Some, _ -> }
^
^^^^
@@ -4,32 +4,33 @@
/jvm.kt:48:14: warning: annotation `@Ann` is missing on actual declaration.
All annotations from expect `class OnClass defined in root package in file common.kt` must be present with the same arguments on actual `class OnClass defined in root package in file jvm.kt`, otherwise they might behave incorrectly.
actual class OnClass
^
^^^^^^^
/jvm.kt:51:16: warning: annotation `@Ann` is missing on actual declaration.
All annotations from expect `fun onMember(): Unit defined in OnMember` must be present with the same arguments on actual `fun onMember(): Unit defined in OnMember`, otherwise they might behave incorrectly.
actual fun onMember() {}
^
^^^^^^^^
/jvm.kt:56:18: warning: annotation `@Ann` is missing on actual declaration.
All annotations from expect `class ViaTypealias defined in root package in file common.kt` must be present with the same arguments on actual `class ViaTypealiasImpl defined in root package in file jvm.kt`, otherwise they might behave incorrectly.
actual typealias ViaTypealias = ViaTypealiasImpl
^
^^^^^^^^^^^^
/jvm.kt:61:18: warning: annotation `@Ann` is missing on actual declaration.
All annotations from expect `fun foo(): Unit defined in MemberScopeViaTypealias` must be present with the same arguments on actual `fun foo(): Unit defined in MemberScopeViaTypealiasImpl`, otherwise they might behave incorrectly.
actual typealias MemberScopeViaTypealias = MemberScopeViaTypealiasImpl
^
^^^^^^^^^^^^^^^^^^^^^^^
/jvm.kt:64:12: warning: annotation `@WithArg(s = "str")` has different arguments on actual declaration: `@WithArg(s = "other str")`.
All annotations from expect `fun withDifferentArg(): Unit defined in root package in file common.kt` must be present with the same arguments on actual `fun withDifferentArg(): Unit defined in root package in file jvm.kt`, otherwise they might behave incorrectly.
actual fun withDifferentArg() {}
^
^^^^^^^^^^^^^^^^
/jvm.kt:66:12: warning: annotation `@Ann` is missing on actual declaration.
All annotations from expect `fun inValueParam(arg: String): Unit defined in root package in file common.kt` must be present with the same arguments on actual `fun inValueParam(arg: String): Unit defined in root package in file jvm.kt`, otherwise they might behave incorrectly.
actual fun inValueParam(arg: String) {}
^
^^^^^^^^^^^^
/jvm.kt:68:16: warning: annotation `@Ann` is missing on actual declaration.
All annotations from expect `fun <T> inTypeParam(): Unit defined in root package in file common.kt` must be present with the same arguments on actual `fun <T> inTypeParam(): Unit defined in root package in file jvm.kt`, otherwise they might behave incorrectly.
actual fun <T> inTypeParam() {}
^
^^^^^^^^^^^
/jvm.kt:70:12: warning: annotation `@Ann` is missing on actual declaration.
All annotations from expect `val onGetter: String defined in root package in file common.kt` must be present with the same arguments on actual `val onGetter: String defined in root package in file jvm.kt`, otherwise they might behave incorrectly.
actual val onGetter: String = ""
^
^^^^^^^^
@@ -1,9 +1,9 @@
/unresolvedOperator.kt:6:6: error: unresolved reference: ++
a++
^
^^
/unresolvedOperator.kt:7:6: error: unresolved reference: --
a--
^
^^
/unresolvedOperator.kt:8:5: error: unresolved reference: +
+a
^
@@ -16,7 +16,7 @@
/unresolvedOperator.kt:11:7: error: unresolved reference: *
a * a
^
/unresolvedOperator.kt:12:10: error: unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
/unresolvedOperator.kt:12:10: error: unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
public operator fun String?.plus(other: Any?): String defined in kotlin
true + false
^
@@ -31,7 +31,8 @@ public operator fun String?.plus(other: Any?): String defined in kotlin
^
/unresolvedOperator.kt:16:7: error: unresolved reference: ..
a .. a
^
^^
/unresolvedOperator.kt:17:7: error: unresolved reference: ..<
a ..< a
^
^^^
@@ -6,5 +6,5 @@
^
/B.kt:23:9: warning: smart cast to 'String' is deprecated, because 'i.x' is a property declared in base class from different module inherited in non-public API class
i.x.length
^
^^^
@@ -1,49 +1,49 @@
/newListMethods.kt:13:18: warning: this declaration overrides deprecated member but not marked as deprecated itself. Please add @Deprecated annotation or suppress. See https://youtrack.jetbrains.com/issue/KT-47902 for details
override fun getFirst(): T = super.getFirst()
^
^^^^^^^^
/newListMethods.kt:13:40: warning: 'getFirst(): E!' is deprecated. Overrides deprecated member in 'java.util.AbstractList'. 'getFirst()' member of List is redundant in Kotlin and might be removed soon. Please use 'first()' stdlib extension instead
override fun getFirst(): T = super.getFirst()
^
^^^^^^^^
/newListMethods.kt:14:18: warning: this declaration overrides deprecated member but not marked as deprecated itself. Please add @Deprecated annotation or suppress. See https://youtrack.jetbrains.com/issue/KT-47902 for details
override fun getLast(): T = super.getLast()
^
^^^^^^^
/newListMethods.kt:14:39: warning: 'getLast(): E!' is deprecated. Overrides deprecated member in 'java.util.AbstractList'. 'getLast()' member of List is redundant in Kotlin and might be removed soon. Please use 'last()' stdlib extension instead
override fun getLast(): T = super.getLast()
^
^^^^^^^
/newListMethods.kt:25:7: warning: 'getFirst(): E!' is deprecated. 'getFirst()' member of List is redundant in Kotlin and might be removed soon. Please use 'first()' stdlib extension instead
x.getFirst()
^
^^^^^^^^
/newListMethods.kt:26:7: warning: 'getter for first: E!' is deprecated. 'getFirst()' member of List is redundant in Kotlin and might be removed soon. Please use 'first()' stdlib extension instead
x.first // synthetic property for getFirst()
^
^^^^^
/newListMethods.kt:28:7: warning: 'getLast(): E!' is deprecated. 'getLast()' member of List is redundant in Kotlin and might be removed soon. Please use 'last()' stdlib extension instead
x.getLast()
^
^^^^^^^
/newListMethods.kt:29:7: warning: 'getter for last: E!' is deprecated. 'getLast()' member of List is redundant in Kotlin and might be removed soon. Please use 'last()' stdlib extension instead
x.last
^
^^^^
/newListMethods.kt:37:7: warning: 'getFirst(): E!' is deprecated. Overrides deprecated member in 'java.util.AbstractList'. 'getFirst()' member of List is redundant in Kotlin and might be removed soon. Please use 'first()' stdlib extension instead
y.getFirst()
^
^^^^^^^^
/newListMethods.kt:38:7: warning: 'getFirst(): E!' is deprecated. Overrides deprecated member in 'java.util.AbstractList'. 'getFirst()' member of List is redundant in Kotlin and might be removed soon. Please use 'first()' stdlib extension instead
y.first
^
^^^^^
/newListMethods.kt:40:7: warning: 'getLast(): E!' is deprecated. Overrides deprecated member in 'java.util.AbstractList'. 'getLast()' member of List is redundant in Kotlin and might be removed soon. Please use 'last()' stdlib extension instead
y.getLast()
^
^^^^^^^
/newListMethods.kt:41:7: warning: 'getLast(): E!' is deprecated. Overrides deprecated member in 'java.util.AbstractList'. 'getLast()' member of List is redundant in Kotlin and might be removed soon. Please use 'last()' stdlib extension instead
y.last
^
^^^^
/newListMethods.kt:49:7: warning: 'getFirst(): E!' is deprecated. Overrides deprecated member in 'java.util.AbstractList'. 'getFirst()' member of List is redundant in Kotlin and might be removed soon. Please use 'first()' stdlib extension instead
z.getFirst()
^
^^^^^^^^
/newListMethods.kt:50:7: warning: 'getFirst(): E!' is deprecated. Overrides deprecated member in 'java.util.AbstractList'. 'getFirst()' member of List is redundant in Kotlin and might be removed soon. Please use 'first()' stdlib extension instead
z.first
^
^^^^^
/newListMethods.kt:52:7: warning: 'getLast(): E!' is deprecated. Overrides deprecated member in 'java.util.AbstractList'. 'getLast()' member of List is redundant in Kotlin and might be removed soon. Please use 'last()' stdlib extension instead
z.getLast()
^
^^^^^^^
/newListMethods.kt:53:7: warning: 'getLast(): E!' is deprecated. Overrides deprecated member in 'java.util.AbstractList'. 'getLast()' member of List is redundant in Kotlin and might be removed soon. Please use 'last()' stdlib extension instead
z.last
^
^^^^