diff --git a/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/compatibilityResolveWhenVariableHasComplexIntersectionType.kt b/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/compatibilityResolveWhenVariableHasComplexIntersectionType.kt index ef60a52fcbb..5f37d5ab262 100644 --- a/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/compatibilityResolveWhenVariableHasComplexIntersectionType.kt +++ b/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/compatibilityResolveWhenVariableHasComplexIntersectionType.kt @@ -1,4 +1,5 @@ // FIR_IDENTICAL +// !LANGUAGE: -ForbidInferringTypeVariablesIntoEmptyIntersection // !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION abstract class Foo diff --git a/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461.diag.txt b/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461.diag.txt index 0149bc95630..729804abb53 100644 --- a/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461.diag.txt +++ b/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461.diag.txt @@ -1,6 +1,6 @@ -/kt45461.kt:5:25: warning: parameter 'foo' is never used +/kt45461.kt:7:25: warning: parameter 'foo' is never used fun takeFoo(foo: Foo) {} ^ -/kt45461.kt:10: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 +/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 a future release Bar().takeFoo(foo) // error in 1.3.72, no error in 1.4.31 ^ diff --git a/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461.kt b/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461.kt index 823b6c8e4af..61eb0a4dbf1 100644 --- a/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461.kt +++ b/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461.kt @@ -1,4 +1,5 @@ // FIR_IDENTICAL +// !LANGUAGE: -ForbidInferringTypeVariablesIntoEmptyIntersection // RENDER_DIAGNOSTICS_FULL_TEXT class Foo diff --git a/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_12.diag.txt b/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_12.diag.txt index d425bda2019..cfac0a7694a 100644 --- a/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_12.diag.txt +++ b/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_12.diag.txt @@ -1,7 +1,7 @@ -/kt45461_12.kt:5:25: warning: parameter 'foo' is never used +/kt45461_12.kt:7:25: warning: parameter 'foo' is never used fun takeFoo(foo: Foo) {} ^ -/kt45461_12.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 +/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 a future release Bar().takeFoo(foo) // error in 1.3.72, no error in 1.4.31 ^ diff --git a/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_12.kt b/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_12.kt index d7731f0126f..a428aca89ef 100644 --- a/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_12.kt +++ b/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_12.kt @@ -1,4 +1,5 @@ // FIR_IDENTICAL +// !LANGUAGE: -ForbidInferringTypeVariablesIntoEmptyIntersection // RENDER_DIAGNOSTICS_FULL_TEXT class Foo diff --git a/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_2.diag.txt b/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_2.diag.txt index 9bd644656b5..3554a735a5f 100644 --- a/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_2.diag.txt +++ b/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_2.diag.txt @@ -1,10 +1,10 @@ -/kt45461_2.kt:5:25: warning: parameter 'foo' is never used +/kt45461_2.kt:7:25: warning: parameter 'foo' is never used fun takeFoo(foo: Foo) {} ^ -/kt45461_2.kt:8:10: warning: 'Int' is a final type, and thus a value of the type parameter is predetermined +/kt45461_2.kt:10:10: warning: 'Int' is a final type, and thus a value of the type parameter is predetermined fun main() { ^ -/kt45461_2.kt:10: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 +/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 a future release Bar().takeFoo(foo) // error in 1.3.72, no error in 1.4.31 ^ diff --git a/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_2.kt b/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_2.kt index 038526470b0..425d4403cad 100644 --- a/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_2.kt +++ b/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_2.kt @@ -1,4 +1,5 @@ // FIR_IDENTICAL +// !LANGUAGE: -ForbidInferringTypeVariablesIntoEmptyIntersection // RENDER_DIAGNOSTICS_FULL_TEXT class Foo diff --git a/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_5.diag.txt b/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_5.diag.txt index aa45a301ae9..4d4f97a0257 100644 --- a/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_5.diag.txt +++ b/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_5.diag.txt @@ -1,6 +1,6 @@ -/kt45461_5.kt:5:25: warning: parameter 'foo' is never used +/kt45461_5.kt:7:25: warning: parameter 'foo' is never used fun takeFoo(foo: Foo) {} ^ -/kt45461_5.kt:10: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 +/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 a future release Bar().takeFoo(foo) // error in 1.3.72, no error in 1.4.31 ^ diff --git a/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_5.kt b/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_5.kt index c0f0085f991..5081aac388a 100644 --- a/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_5.kt +++ b/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_5.kt @@ -1,4 +1,5 @@ // FIR_IDENTICAL +// !LANGUAGE: -ForbidInferringTypeVariablesIntoEmptyIntersection // RENDER_DIAGNOSTICS_FULL_TEXT class Foo diff --git a/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt48765.diag.txt b/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt48765.diag.txt index e496cf130b9..6f5333c4718 100644 --- a/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt48765.diag.txt +++ b/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt48765.diag.txt @@ -1,16 +1,16 @@ -/kt48765.kt:4:44: warning: parameter 'x1' is never used +/kt48765.kt:6:44: warning: parameter 'x1' is never used fun > foo(x1: T2, x2: T1) {} ^ -/kt48765.kt:4:52: warning: parameter 'x2' is never used +/kt48765.kt:6:52: warning: parameter 'x2' is never used fun > foo(x1: T2, x2: T1) {} ^ -/kt48765.kt:8: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 +/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 a future release B().foo(x, foo()) ^ -/kt48765.kt:12:9: warning: 'String' is a final type, and thus a value of the type parameter is predetermined +/kt48765.kt:14:9: warning: 'String' is a final type, and thus a value of the type parameter is predetermined fun foo(): T { ^ -/kt48765.kt:13:15: warning: unchecked cast: String to T +/kt48765.kt:15:15: warning: unchecked cast: String to T return "" as T // this cast is safe because String is final. ^ diff --git a/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt48765.kt b/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt48765.kt index e32a9babf44..2e738b83fce 100644 --- a/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt48765.kt +++ b/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt48765.kt @@ -1,4 +1,5 @@ // FIR_IDENTICAL +// !LANGUAGE: -ForbidInferringTypeVariablesIntoEmptyIntersection // RENDER_DIAGNOSTICS_FULL_TEXT open class A {} class B { diff --git a/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt48935_3.kt b/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt48935_3.kt index 2497f141e37..9ad74e514ab 100644 --- a/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt48935_3.kt +++ b/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt48935_3.kt @@ -1,4 +1,5 @@ // FIR_IDENTICAL +// !LANGUAGE: -ForbidInferringTypeVariablesIntoEmptyIntersection open class Base open class DoesNotImplementBase diff --git a/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt48935_4.kt b/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt48935_4.kt index 29f98f40125..7d615498a17 100644 --- a/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt48935_4.kt +++ b/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt48935_4.kt @@ -1,4 +1,5 @@ // FIR_IDENTICAL +// !LANGUAGE: -ForbidInferringTypeVariablesIntoEmptyIntersection open class Base class DoesNotImplementBase diff --git a/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt49661.diag.txt b/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt49661.diag.txt index e94577ed23e..ae2953de3d0 100644 --- a/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt49661.diag.txt +++ b/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt49661.diag.txt @@ -1,4 +1,4 @@ -/kt49661.kt:10:5: warning: type argument for a type parameter T can't be inferred because it has incompatible upper bounds: Foo, Int (multiple incompatible classes). This will become an error in Kotlin 2.0 +/kt49661.kt:12:5: warning: type argument for a type parameter T can't be inferred because it has incompatible upper bounds: Foo, Int (multiple incompatible classes). This will become an error in a future release f { g() } ^ diff --git a/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt49661.kt b/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt49661.kt index db2d5d4315d..8c898863f34 100644 --- a/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt49661.kt +++ b/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt49661.kt @@ -1,4 +1,5 @@ // FIR_IDENTICAL +// !LANGUAGE: -ForbidInferringTypeVariablesIntoEmptyIntersection // RENDER_DIAGNOSTICS_FULL_TEXT open class Foo inline fun g(): T? = null diff --git a/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/nullableEmptyIntersection.kt b/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/nullableEmptyIntersection.kt index 90b031bb981..fb0f775cbe7 100644 --- a/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/nullableEmptyIntersection.kt +++ b/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/nullableEmptyIntersection.kt @@ -1,4 +1,5 @@ // FIR_IDENTICAL +// !LANGUAGE: -ForbidInferringTypeVariablesIntoEmptyIntersection fun String> g(): T? = null fun f(block: () -> R?): R? = block() diff --git a/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/selectFromCovariantAndContravariantTypes.diag.txt b/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/selectFromCovariantAndContravariantTypes.diag.txt index 700e3a4d65d..d5886631e43 100644 --- a/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/selectFromCovariantAndContravariantTypes.diag.txt +++ b/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/selectFromCovariantAndContravariantTypes.diag.txt @@ -1,12 +1,12 @@ -/selectFromCovariantAndContravariantTypes.kt:10:22: warning: parameter 'y' is never used +/selectFromCovariantAndContravariantTypes.kt:12:22: warning: parameter 'y' is never used fun select(x: K, y: K): K = x ^ -/selectFromCovariantAndContravariantTypes.kt:11:19: warning: parameter 'x' is never used +/selectFromCovariantAndContravariantTypes.kt:13:19: warning: parameter 'x' is never used fun genericIn(x: In) {} ^ -/selectFromCovariantAndContravariantTypes.kt:12:20: warning: parameter 'x' is never used +/selectFromCovariantAndContravariantTypes.kt:14:20: warning: parameter 'x' is never used fun genericOut(x: Out) {} ^ -/selectFromCovariantAndContravariantTypes.kt:15: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 +/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 a future release genericIn(select(a, b)) ^ diff --git a/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/selectFromCovariantAndContravariantTypes.kt b/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/selectFromCovariantAndContravariantTypes.kt index 0e66729ace7..06151fe497e 100644 --- a/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/selectFromCovariantAndContravariantTypes.kt +++ b/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/selectFromCovariantAndContravariantTypes.kt @@ -1,4 +1,5 @@ // FIR_IDENTICAL +// !LANGUAGE: -ForbidInferringTypeVariablesIntoEmptyIntersection // RENDER_DIAGNOSTICS_FULL_TEXT // !DIAGNOSTICS: -UNUSED_PARAMETER