Update tests after switching to LV 1.9
This commit is contained in:
committed by
Space Team
parent
66544a4e00
commit
88efa6bfb6
@@ -15,13 +15,13 @@ val z = 3
|
||||
|
||||
fun foo(x: Int = <!UNINITIALIZED_PARAMETER!>y<!>, y: Int = x, i : Int = z): Int = x + y
|
||||
|
||||
fun foo(x: () -> Int = { <!UNINITIALIZED_PARAMETER_WARNING!>y<!> }, y: Int = x(), i : Int = z): Int = x() + y
|
||||
fun foo(x: () -> Int = { <!UNINITIALIZED_PARAMETER!>y<!> }, y: Int = x(), i : Int = z): Int = x() + y
|
||||
|
||||
fun bar(x: () -> Int = { <!UNINITIALIZED_PARAMETER_WARNING!>y<!>; 1 }, y: Int) {}
|
||||
fun bar(x: () -> Int = { <!UNINITIALIZED_PARAMETER!>y<!>; 1 }, y: Int) {}
|
||||
|
||||
fun baz(
|
||||
x: () -> Int = {
|
||||
fun bar(xx: () -> Int = { <!UNINITIALIZED_PARAMETER_WARNING!>y<!>; 1 }) = xx
|
||||
fun bar(xx: () -> Int = { <!UNINITIALIZED_PARAMETER!>y<!>; 1 }) = xx
|
||||
bar()()
|
||||
},
|
||||
y: Int
|
||||
@@ -30,7 +30,7 @@ fun baz(
|
||||
|
||||
fun boo(
|
||||
x: () -> Int = {
|
||||
fun bar(): Int = <!UNINITIALIZED_PARAMETER_WARNING!>y<!>
|
||||
fun bar(): Int = <!UNINITIALIZED_PARAMETER!>y<!>
|
||||
bar()
|
||||
},
|
||||
y: Int
|
||||
|
||||
@@ -7,7 +7,7 @@ fun foo(a: (String) -> Unit) {
|
||||
interface A : (String) -> Unit {}
|
||||
typealias AliasedEFT = ExtensionFunctionType
|
||||
|
||||
fun foo(a: <!WRONG_EXTENSION_FUNCTION_TYPE_WARNING!>@AliasedEFT<!> A) {
|
||||
fun foo(a: <!WRONG_EXTENSION_FUNCTION_TYPE!>@AliasedEFT<!> A) {
|
||||
// @Extension annotation on an unrelated type shouldn't have any effect on this diagnostic.
|
||||
// Only kotlin.Function{n} type annotated with @Extension should
|
||||
"".a()
|
||||
|
||||
@@ -7,7 +7,7 @@ fun foo(a: (String) -> Unit) {
|
||||
interface A : (String) -> Unit {}
|
||||
typealias AliasedEFT = ExtensionFunctionType
|
||||
|
||||
fun foo(a: <!WRONG_EXTENSION_FUNCTION_TYPE_WARNING!>@AliasedEFT<!> A) {
|
||||
fun foo(a: <!WRONG_EXTENSION_FUNCTION_TYPE!>@AliasedEFT<!> A) {
|
||||
// @Extension annotation on an unrelated type shouldn't have any effect on this diagnostic.
|
||||
// Only kotlin.Function{n} type annotated with @Extension should
|
||||
"".<!UNRESOLVED_REFERENCE!>a<!>()
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
// WITH_STDLIB
|
||||
|
||||
fun <E> SmartList(x: E) {}
|
||||
fun <E> SmartList(x: Collection<E>) {}
|
||||
|
||||
fun append(x: Any?) {}
|
||||
fun append(x: Collection<*>) {}
|
||||
|
||||
fun append2(x: Iterable<*>) {}
|
||||
fun append2(x: Collection<*>) {}
|
||||
|
||||
class In<in T>(x: T)
|
||||
|
||||
@JvmName("append31")
|
||||
fun append3(x: In<Nothing>) {}
|
||||
fun append3(x: In<Collection<*>>) {}
|
||||
|
||||
fun <E> append4(x: E) {}
|
||||
fun <E: Collection<*>> append4(x: E) {}
|
||||
|
||||
fun <T> takes(range: T) {}
|
||||
fun <T> takes(range: T) where T : Collection<*>, T: ClosedRange<*> {}
|
||||
|
||||
fun main() {
|
||||
SmartList(1..2) // warning
|
||||
SmartList<IntRange>(1..10) // no warning
|
||||
|
||||
append(1..10) // warning
|
||||
append((1..10) as Any) // no warning
|
||||
append((1..10) as Iterable<Int>) // no warning
|
||||
append("a".."z") // no warning, the range is not iterable
|
||||
append(1.0..2.0)
|
||||
|
||||
append2(1..10) // no warning
|
||||
|
||||
append3(In(1..10)) // no warning
|
||||
|
||||
append4(1..10) // warning
|
||||
|
||||
append4<IntRange>(1..10) // warning
|
||||
|
||||
takes(1..10) // warning
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// WITH_STDLIB
|
||||
|
||||
fun <E> SmartList(x: E) {}
|
||||
@@ -22,10 +23,10 @@ fun <T> takes(range: T) {}
|
||||
fun <T> takes(range: T) where T : Collection<*>, T: ClosedRange<*> {}
|
||||
|
||||
fun main() {
|
||||
SmartList(<!PROGRESSIONS_CHANGING_RESOLVE_ERROR!>1..2<!>) // warning
|
||||
SmartList(1..2) // warning
|
||||
SmartList<IntRange>(1..10) // no warning
|
||||
|
||||
append(<!PROGRESSIONS_CHANGING_RESOLVE_ERROR!>1..10<!>) // warning
|
||||
append(1..10) // warning
|
||||
append((1..10) as Any) // no warning
|
||||
append((1..10) as Iterable<Int>) // no warning
|
||||
append("a".."z") // no warning, the range is not iterable
|
||||
@@ -35,9 +36,9 @@ fun main() {
|
||||
|
||||
append3(In(1..10)) // no warning
|
||||
|
||||
append4(<!PROGRESSIONS_CHANGING_RESOLVE_ERROR!>1..10<!>) // warning
|
||||
append4(1..10) // warning
|
||||
|
||||
append4<IntRange>(1..10) // warning
|
||||
|
||||
takes(<!PROGRESSIONS_CHANGING_RESOLVE_ERROR!>1..10<!>) // warning
|
||||
takes(1..10) // warning
|
||||
}
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
// WITH_STDLIB
|
||||
// !LANGUAGE: +ProgressionsChangingResolve
|
||||
|
||||
fun <E> SmartList(x: E) {}
|
||||
fun <E> SmartList(x: Collection<E>) {}
|
||||
|
||||
fun append(x: Any?) {}
|
||||
fun append(x: Collection<*>) {}
|
||||
|
||||
fun append2(x: Iterable<*>) {}
|
||||
fun append2(x: Collection<*>) {}
|
||||
|
||||
class In<in T>(x: T)
|
||||
|
||||
@JvmName("append31")
|
||||
fun append3(x: In<Nothing>) {}
|
||||
fun append3(x: In<Collection<*>>) {}
|
||||
|
||||
fun <E> append4(x: E) {}
|
||||
fun <E: Collection<*>> append4(x: E) {}
|
||||
|
||||
fun main() {
|
||||
SmartList(1..2) // warning
|
||||
SmartList<IntRange>(1..10) // no warning
|
||||
|
||||
append(1..10) // warning
|
||||
append((1..10) as Any) // no warning
|
||||
append((1..10) as Iterable<Int>) // no warning
|
||||
append("a".."z") // no warning, the range is not iterable
|
||||
append(1.0..2.0)
|
||||
|
||||
append2(1..10) // no warning
|
||||
|
||||
append3(In(1..10)) // no warning
|
||||
|
||||
append4(1..10) // warning
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// WITH_STDLIB
|
||||
// !LANGUAGE: +ProgressionsChangingResolve
|
||||
|
||||
@@ -20,10 +21,10 @@ fun <E> append4(x: E) {}
|
||||
fun <E: Collection<*>> append4(x: E) {}
|
||||
|
||||
fun main() {
|
||||
SmartList(<!PROGRESSIONS_CHANGING_RESOLVE_ERROR("fun <E> SmartList(x: Collection<E>): Unit")!>1..2<!>) // warning
|
||||
SmartList(1..2) // warning
|
||||
SmartList<IntRange>(1..10) // no warning
|
||||
|
||||
append(<!PROGRESSIONS_CHANGING_RESOLVE_ERROR("fun append(x: Collection<*>): Unit")!>1..10<!>) // warning
|
||||
append(1..10) // warning
|
||||
append((1..10) as Any) // no warning
|
||||
append((1..10) as Iterable<Int>) // no warning
|
||||
append("a".."z") // no warning, the range is not iterable
|
||||
@@ -33,5 +34,5 @@ fun main() {
|
||||
|
||||
append3(In(1..10)) // no warning
|
||||
|
||||
append4(<!PROGRESSIONS_CHANGING_RESOLVE_ERROR("fun <E : Collection<*>> append4(x: E): Unit")!>1..10<!>) // warning
|
||||
append4(1..10) // warning
|
||||
}
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
// WITH_STDLIB
|
||||
// FULL_JDK
|
||||
|
||||
// FILE: JavaSmartList.java
|
||||
import kotlin.ranges.ClosedRange;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public class JavaSmartList <E> {
|
||||
JavaSmartList(E x) {}
|
||||
JavaSmartList(Collection<E> x) {}
|
||||
|
||||
static void append(Object x) {}
|
||||
static void append(Collection<?> x) {}
|
||||
|
||||
static void append2(Iterable<?> x) {}
|
||||
static void append2(Collection<?> x) {}
|
||||
|
||||
public static class In <T> {
|
||||
In(T x) {}
|
||||
}
|
||||
|
||||
static void append3(In<?> x) {}
|
||||
static void append3(In<Collection<?>> x) {}
|
||||
|
||||
static <E> void append4(E x) {}
|
||||
static <E extends Collection<?>> void append4(E x) {}
|
||||
|
||||
static <T> void takes(T x) {}
|
||||
static <T extends Collection<?> & ClosedRange<?>> void takes(T x) {}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
fun main() {
|
||||
JavaSmartList(1..2) // warning
|
||||
JavaSmartList<IntRange>(1..10) // no warning
|
||||
|
||||
JavaSmartList.append(1..10) // warning
|
||||
JavaSmartList.append((1..10) as Any) // no warning
|
||||
JavaSmartList.append((1..10) as Iterable<Int>) // no warning
|
||||
JavaSmartList.append("a".."z") // no warning, the range is not iterable
|
||||
JavaSmartList.append(1.0..2.0)
|
||||
|
||||
JavaSmartList.append2(1..10) // no warning
|
||||
|
||||
JavaSmartList.append3(JavaSmartList.In(1..10)) // no warning
|
||||
|
||||
JavaSmartList.append4(1..10) // warning
|
||||
|
||||
JavaSmartList.append4<IntRange>(1..10) // warning
|
||||
|
||||
JavaSmartList.takes(1..10) // warning
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// WITH_STDLIB
|
||||
// FULL_JDK
|
||||
|
||||
@@ -32,10 +33,10 @@ public class JavaSmartList <E> {
|
||||
|
||||
// FILE: main.kt
|
||||
fun main() {
|
||||
JavaSmartList(<!PROGRESSIONS_CHANGING_RESOLVE_ERROR!>1..2<!>) // warning
|
||||
JavaSmartList(1..2) // warning
|
||||
JavaSmartList<IntRange>(1..10) // no warning
|
||||
|
||||
JavaSmartList.append(<!PROGRESSIONS_CHANGING_RESOLVE_ERROR!>1..10<!>) // warning
|
||||
JavaSmartList.append(1..10) // warning
|
||||
JavaSmartList.append((1..10) as Any) // no warning
|
||||
JavaSmartList.append((1..10) as Iterable<Int>) // no warning
|
||||
JavaSmartList.append("a".."z") // no warning, the range is not iterable
|
||||
@@ -45,9 +46,9 @@ fun main() {
|
||||
|
||||
JavaSmartList.append3(JavaSmartList.In(1..10)) // no warning
|
||||
|
||||
JavaSmartList.append4(<!PROGRESSIONS_CHANGING_RESOLVE_ERROR!>1..10<!>) // warning
|
||||
JavaSmartList.append4(1..10) // warning
|
||||
|
||||
JavaSmartList.append4<IntRange>(1..10) // warning
|
||||
|
||||
JavaSmartList.takes(<!PROGRESSIONS_CHANGING_RESOLVE_ERROR!>1..10<!>) // warning
|
||||
JavaSmartList.takes(1..10) // warning
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
// SKIP_TXT
|
||||
|
||||
enum class A(val z: Any) {
|
||||
Y(<!UNINITIALIZED_ENUM_COMPANION_WARNING, UNINITIALIZED_VARIABLE!>x<!>);
|
||||
Y(<!UNINITIALIZED_ENUM_COMPANION, UNINITIALIZED_VARIABLE!>x<!>);
|
||||
|
||||
companion object {
|
||||
val x = A.Y.ordinal
|
||||
@@ -9,7 +9,7 @@ enum class A(val z: Any) {
|
||||
}
|
||||
|
||||
enum class B(val z: Any) {
|
||||
Y(<!UNINITIALIZED_ENUM_COMPANION_WARNING!>B<!>.x);
|
||||
Y(<!UNINITIALIZED_ENUM_COMPANION!>B<!>.x);
|
||||
|
||||
companion object {
|
||||
val x = B.Y.ordinal
|
||||
|
||||
+4
-4
@@ -9,7 +9,7 @@ enum class B(val x: Int) {
|
||||
}
|
||||
|
||||
enum class C(val x: Int) {
|
||||
C1(<!UNINITIALIZED_ENUM_COMPANION_WARNING, UNINITIALIZED_VARIABLE!>SUM<!>),
|
||||
C1(<!UNINITIALIZED_ENUM_COMPANION, UNINITIALIZED_VARIABLE!>SUM<!>),
|
||||
C2(1);
|
||||
|
||||
companion object {
|
||||
@@ -32,8 +32,8 @@ enum class Fruit(personal: Int) {
|
||||
|
||||
// Another example from KT-11769
|
||||
enum class EnumCompanion1(val x: Int) {
|
||||
INSTANCE(<!UNINITIALIZED_ENUM_COMPANION, UNINITIALIZED_ENUM_COMPANION_WARNING!>Companion<!>.foo()),
|
||||
ANOTHER(<!UNINITIALIZED_ENUM_COMPANION_WARNING!>foo()<!>);
|
||||
INSTANCE(<!UNINITIALIZED_ENUM_COMPANION!>Companion<!>.foo()),
|
||||
ANOTHER(<!UNINITIALIZED_ENUM_COMPANION!>foo()<!>);
|
||||
|
||||
companion object {
|
||||
fun foo() = 42
|
||||
@@ -41,7 +41,7 @@ enum class EnumCompanion1(val x: Int) {
|
||||
}
|
||||
// Also should be reported for implicit receiver
|
||||
enum class EnumCompanion2(val x: Int) {
|
||||
INSTANCE(<!UNINITIALIZED_ENUM_COMPANION_WARNING!><!UNINITIALIZED_ENUM_COMPANION!>foo<!>()<!>);
|
||||
INSTANCE(<!UNINITIALIZED_ENUM_COMPANION!>foo()<!>);
|
||||
|
||||
companion object {
|
||||
fun foo() = 42
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
object DelegateTest {
|
||||
var result = ""
|
||||
val f by lazy {
|
||||
result += <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE, TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM_WARNING!>f<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>toString<!>() // Compiler crash
|
||||
result += <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE, TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM_ERROR!>f<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>toString<!>() // Compiler crash
|
||||
"hello"
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@ object DelegateTest {
|
||||
object DelegateTest2 {
|
||||
var result = ""
|
||||
val f by lazy {
|
||||
result += <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM_WARNING!>f<!>
|
||||
result += <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM_ERROR!>f<!>
|
||||
"hello"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
val a by <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE, TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM_ERROR, TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM_ERROR, TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM_WARNING!>a<!>
|
||||
val a by <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE, TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM_ERROR, TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM_ERROR!>a<!>
|
||||
|
||||
val b by Delegate(<!DEBUG_INFO_MISSING_UNRESOLVED, TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM_ERROR!>b<!>)
|
||||
|
||||
val c by <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE, UNINITIALIZED_VARIABLE!>d<!>
|
||||
val d by <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE, TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM_WARNING!>c<!>
|
||||
val d by <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE, TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM_ERROR!>c<!>
|
||||
|
||||
class Delegate(i: Int) {
|
||||
operator fun getValue(t: Any?, p: KProperty<*>): Int {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
object DelegateTest {
|
||||
var result = ""
|
||||
val f by lazy {
|
||||
result += <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE, TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM_WARNING!>f<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>toString<!>() // Compiler crash
|
||||
result += <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE, TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM_ERROR!>f<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>toString<!>() // Compiler crash
|
||||
"hello"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -1,3 +1,3 @@
|
||||
package typeReferenceError
|
||||
|
||||
<!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>class Pair<!><<!SYNTAX!><!>:(<!UNSUPPORTED!>val<!> <!UNSUPPORTED!>c<!>: <!SYNTAX!><!SYNTAX!><!>fun<!><!SYNTAX!><!> <!UNRESOLVED_REFERENCE!>main<!><!NO_CONSTRUCTOR_WARNING!>()<!>
|
||||
<!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>class Pair<!><<!SYNTAX!><!>:(<!UNSUPPORTED!>val<!> <!UNSUPPORTED!>c<!>: <!SYNTAX!><!SYNTAX!><!>fun<!><!SYNTAX!><!> <!UNRESOLVED_REFERENCE!>main<!><!NO_CONSTRUCTOR!>()<!>
|
||||
|
||||
+2
-10
@@ -1,12 +1,4 @@
|
||||
/kt47986Default.kt:4:18: warning: parameter 'builderAction' is never used
|
||||
fun <K> buildFoo(builderAction: Foo<K>.() -> Unit): Foo<K> = Foo()
|
||||
^
|
||||
/kt47986Default.kt:6:20: warning: parameter 'x' is never used
|
||||
fun <K> Foo<K>.bar(x: Int = 1) {}
|
||||
^
|
||||
/kt47986Default.kt:9:9: warning: variable 'x' is never used
|
||||
val x = buildFoo {
|
||||
^
|
||||
/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.
|
||||
/kt47986Default.kt:10:13: error: not enough information to infer type variable K
|
||||
val x = buildFoo {
|
||||
^
|
||||
|
||||
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
// !RENDER_DIAGNOSTICS_FULL_TEXT
|
||||
class Foo<K>
|
||||
|
||||
fun <K> buildFoo(builderAction: Foo<K>.() -> Unit): Foo<K> = Foo()
|
||||
|
||||
fun <K> Foo<K>.bar(x: Int = 1) {}
|
||||
|
||||
fun main() {
|
||||
val x = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>buildFoo<!> {
|
||||
bar()
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !RENDER_DIAGNOSTICS_FULL_TEXT
|
||||
class Foo<K>
|
||||
|
||||
@@ -6,7 +7,7 @@ fun <K> buildFoo(builderAction: Foo<K>.() -> Unit): Foo<K> = Foo()
|
||||
fun <K> Foo<K>.bar(x: Int = 1) {}
|
||||
|
||||
fun main() {
|
||||
val x = <!INFERRED_INTO_DECLARED_UPPER_BOUNDS!>buildFoo<!> {
|
||||
val x = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>buildFoo<!> {
|
||||
bar()
|
||||
}
|
||||
}
|
||||
|
||||
+2
-10
@@ -1,12 +1,4 @@
|
||||
/kt47986_2.kt:4:18: warning: parameter 'builderAction' is never used
|
||||
fun <K> buildFoo(builderAction: Foo<K>.() -> Unit): Foo<K> = Foo()
|
||||
^
|
||||
/kt47986_2.kt:11:9: warning: variable 'x' is never used
|
||||
val x = buildFoo { // can't infer
|
||||
^
|
||||
/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.
|
||||
/kt47986_2.kt:12:13: error: not enough information to infer type variable K
|
||||
val x = buildFoo { // can't infer
|
||||
^
|
||||
/kt47986_2.kt:12:13: warning: variable 'y' is never used
|
||||
val y = id(::bar)
|
||||
^
|
||||
|
||||
|
||||
-14
@@ -1,14 +0,0 @@
|
||||
// !RENDER_DIAGNOSTICS_FULL_TEXT
|
||||
class Foo<K>
|
||||
|
||||
fun <K> buildFoo(builderAction: Foo<K>.() -> Unit): Foo<K> = Foo()
|
||||
|
||||
fun <L> Foo<L>.bar() {}
|
||||
|
||||
fun <K> id(x: K) = x
|
||||
|
||||
fun main() {
|
||||
val x = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>buildFoo<!> { // can't infer
|
||||
val y = id(::bar)
|
||||
}
|
||||
}
|
||||
+3
-2
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !RENDER_DIAGNOSTICS_FULL_TEXT
|
||||
class Foo<K>
|
||||
|
||||
@@ -8,7 +9,7 @@ fun <L> Foo<L>.bar() {}
|
||||
fun <K> id(x: K) = x
|
||||
|
||||
fun main() {
|
||||
val x = <!INFERRED_INTO_DECLARED_UPPER_BOUNDS!>buildFoo<!> { // can't infer
|
||||
val x = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>buildFoo<!> { // can't infer
|
||||
val y = id(::bar)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-10
@@ -1,12 +1,4 @@
|
||||
/kt47986_3.kt:4:18: warning: parameter 'builderAction' is never used
|
||||
fun <K> buildFoo(builderAction: Foo<K>.() -> Unit): Foo<K> = Foo()
|
||||
^
|
||||
/kt47986_3.kt:6:26: warning: parameter 'x' is never used
|
||||
fun <K: N, N> Foo<K>.bar(x: Int = 1) {}
|
||||
^
|
||||
/kt47986_3.kt:9:9: warning: variable 'x' is never used
|
||||
val x = buildFoo {
|
||||
^
|
||||
/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.
|
||||
/kt47986_3.kt:10:13: error: not enough information to infer type variable K
|
||||
val x = buildFoo {
|
||||
^
|
||||
|
||||
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
// !RENDER_DIAGNOSTICS_FULL_TEXT
|
||||
class Foo<K>
|
||||
|
||||
fun <K> buildFoo(builderAction: Foo<K>.() -> Unit): Foo<K> = Foo()
|
||||
|
||||
fun <K: N, N> Foo<K>.bar(x: Int = 1) {}
|
||||
|
||||
fun main() {
|
||||
val x = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>buildFoo<!> {
|
||||
bar()
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !RENDER_DIAGNOSTICS_FULL_TEXT
|
||||
class Foo<K>
|
||||
|
||||
@@ -6,7 +7,7 @@ fun <K> buildFoo(builderAction: Foo<K>.() -> Unit): Foo<K> = Foo()
|
||||
fun <K: N, N> Foo<K>.bar(x: Int = 1) {}
|
||||
|
||||
fun main() {
|
||||
val x = <!INFERRED_INTO_DECLARED_UPPER_BOUNDS!>buildFoo<!> {
|
||||
val x = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>buildFoo<!> {
|
||||
bar()
|
||||
}
|
||||
}
|
||||
|
||||
+2
-10
@@ -1,12 +1,4 @@
|
||||
/kt51464.kt:2:16: warning: parameter 'value' is never used
|
||||
fun <T> flowOf(value: T): Flow<T> = TODO()
|
||||
^
|
||||
/kt51464.kt:8:30: warning: parameter 'transform' is never used
|
||||
fun <T, R> Flow<T>.transform(transform: FlowCollector<R>.(T) -> Unit): Flow<R> = TODO()
|
||||
^
|
||||
/kt51464.kt:11:20: warning: parameter 'collector' is never used
|
||||
fun <T> doEmit(collector: FlowCollector<T>) {}
|
||||
^
|
||||
/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.
|
||||
/kt51464.kt:13:15: error: not enough information to infer type variable R
|
||||
flowOf(1).transform { doEmit(this) }
|
||||
^
|
||||
|
||||
|
||||
-13
@@ -1,13 +0,0 @@
|
||||
// !RENDER_DIAGNOSTICS_FULL_TEXT
|
||||
fun <T> flowOf(value: T): Flow<T> = TODO()
|
||||
|
||||
interface FlowCollector<in T> {}
|
||||
|
||||
interface Flow<out T>
|
||||
|
||||
fun <T, R> Flow<T>.transform(transform: FlowCollector<R>.(T) -> Unit): Flow<R> = TODO()
|
||||
|
||||
fun f() {
|
||||
fun <T> doEmit(collector: FlowCollector<T>) {}
|
||||
flowOf(1).<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>transform<!> { doEmit(this) }
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !RENDER_DIAGNOSTICS_FULL_TEXT
|
||||
fun <T> flowOf(value: T): Flow<T> = TODO()
|
||||
|
||||
@@ -9,5 +10,5 @@ fun <T, R> Flow<T>.transform(transform: FlowCollector<R>.(T) -> Unit): Flow<R> =
|
||||
|
||||
fun f() {
|
||||
fun <T> doEmit(collector: FlowCollector<T>) {}
|
||||
flowOf(1).<!INFERRED_INTO_DECLARED_UPPER_BOUNDS!>transform<!> { doEmit(this) }
|
||||
}
|
||||
flowOf(1).<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>transform<!> { doEmit(this) }
|
||||
}
|
||||
|
||||
@@ -10,10 +10,10 @@ data class InputWrapper<TItem>(val value: TItem)
|
||||
data class Output(val source: InputWrapper<List<String>>)
|
||||
|
||||
fun main2(input: InputWrapper<Unit>): Output {
|
||||
val output = input.<!INFERRED_INTO_DECLARED_UPPER_BOUNDS!>doMapping<!>(
|
||||
val output = input.doMapping(
|
||||
foo = { buildList { add("this is List<String>") } },
|
||||
<!BUILDER_INFERENCE_MULTI_LAMBDA_RESTRICTION!>bar = { it.isNotEmpty() }<!>,
|
||||
)
|
||||
|
||||
return Output(source = <!TYPE_MISMATCH!>output<!>)
|
||||
return Output(source = output)
|
||||
}
|
||||
|
||||
+7
-7
@@ -8,7 +8,7 @@ fun <T> T.extension() {}
|
||||
fun use(p: Any?) {}
|
||||
|
||||
fun test1() {
|
||||
<!INFERRED_INTO_DECLARED_UPPER_BOUNDS!>a<!> {
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>a<!> {
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER("R; a")!>this.get(0)<!>.extension()
|
||||
use(<!BUILDER_INFERENCE_STUB_RECEIVER("R; a")!>this.get(0)<!>::extension)
|
||||
use(<!BUILDER_INFERENCE_STUB_RECEIVER("R; a")!>it<!>::extension)
|
||||
@@ -17,7 +17,7 @@ fun test1() {
|
||||
|
||||
|
||||
fun test2() {
|
||||
<!INFERRED_INTO_DECLARED_UPPER_BOUNDS!>a<!> {
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>a<!> {
|
||||
val v = this.get(0)
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER("R; a")!>v<!>.extension()
|
||||
use(<!BUILDER_INFERENCE_STUB_RECEIVER("R; a")!>v<!>::extension)
|
||||
@@ -27,7 +27,7 @@ fun test2() {
|
||||
|
||||
fun test3() {
|
||||
operator fun <T> T.getValue(thisRef: Any?, prop: Any?): T = this
|
||||
<!INFERRED_INTO_DECLARED_UPPER_BOUNDS!>a<!> {
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>a<!> {
|
||||
val v by <!BUILDER_INFERENCE_STUB_RECEIVER("R; a")!>this.get(0)<!>
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER("R; a")!>v<!>.extension()
|
||||
use(<!BUILDER_INFERENCE_STUB_RECEIVER("R; a")!>v<!>::extension)
|
||||
@@ -40,7 +40,7 @@ class Box<TIn>(val t: TIn)
|
||||
fun test4() {
|
||||
operator fun <T> T.provideDelegate(thisRef: Any?, prop: Any?): Box<T> = Box(this)
|
||||
operator fun <T> Box<T>.getValue(thisRef: Any?, prop: Any?): T = this.t
|
||||
<!INFERRED_INTO_DECLARED_UPPER_BOUNDS!>a<!> {
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>a<!> {
|
||||
val v by <!BUILDER_INFERENCE_STUB_RECEIVER("R; a")!>this.get(0)<!>
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER("R; a")!>v<!>.extension()
|
||||
use(<!BUILDER_INFERENCE_STUB_RECEIVER("R; a")!>v<!>::extension)
|
||||
@@ -53,7 +53,7 @@ fun <R> b(lambda: R.(List<R>) -> Unit) {}
|
||||
fun test5() {
|
||||
|
||||
operator fun <T> T.invoke(): T = this
|
||||
<!INFERRED_INTO_DECLARED_UPPER_BOUNDS!>b<!> {
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>b<!> {
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER("R; b")!>extension()<!>
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER("R; b")!><!BUILDER_INFERENCE_STUB_RECEIVER("R; b")!>this<!>()<!>.extension()
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER("R; b")!>use(::extension)<!>
|
||||
@@ -63,10 +63,10 @@ fun test5() {
|
||||
val <T> T.genericLambda: T.((T) -> Unit) -> Unit get() = {}
|
||||
|
||||
fun test6() {
|
||||
<!INFERRED_INTO_DECLARED_UPPER_BOUNDS!>b<!> {
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>b<!> {
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER("R; b")!>extension()<!>
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER("R; b")!>genericLambda<!> { }
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER("R; b")!>genericLambda<!> { <!BUILDER_INFERENCE_STUB_RECEIVER("R; b")!>it<!>.extension() }
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER("R; b")!>use(::extension)<!>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+7
-7
@@ -9,7 +9,7 @@ fun <T> T.extension() {}
|
||||
fun use(p: Any?) {}
|
||||
|
||||
fun test1() {
|
||||
<!INFERRED_INTO_DECLARED_UPPER_BOUNDS!>a<!> {
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>a<!> {
|
||||
this.get(0).extension()
|
||||
use(this.get(0)::extension)
|
||||
use(it::extension)
|
||||
@@ -18,7 +18,7 @@ fun test1() {
|
||||
|
||||
|
||||
fun test2() {
|
||||
<!INFERRED_INTO_DECLARED_UPPER_BOUNDS!>a<!> {
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>a<!> {
|
||||
val v = this.get(0)
|
||||
v.extension()
|
||||
use(v::extension)
|
||||
@@ -28,7 +28,7 @@ fun test2() {
|
||||
|
||||
fun test3() {
|
||||
operator fun <T> T.getValue(thisRef: Any?, prop: Any?): T = this
|
||||
<!INFERRED_INTO_DECLARED_UPPER_BOUNDS!>a<!> {
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>a<!> {
|
||||
val v by this.get(0)
|
||||
v.extension()
|
||||
use(v::extension)
|
||||
@@ -41,7 +41,7 @@ class Box<TIn>(val t: TIn)
|
||||
fun test4() {
|
||||
operator fun <T> T.provideDelegate(thisRef: Any?, prop: Any?): Box<T> = Box(this)
|
||||
operator fun <T> Box<T>.getValue(thisRef: Any?, prop: Any?): T = this.t
|
||||
<!INFERRED_INTO_DECLARED_UPPER_BOUNDS!>a<!> {
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>a<!> {
|
||||
val v by this.get(0)
|
||||
v.extension()
|
||||
use(v::extension)
|
||||
@@ -54,7 +54,7 @@ fun <R> b(lambda: R.(List<R>) -> Unit) {}
|
||||
fun test5() {
|
||||
|
||||
operator fun <T> T.invoke(): T = this
|
||||
<!INFERRED_INTO_DECLARED_UPPER_BOUNDS!>b<!> {
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>b<!> {
|
||||
extension()
|
||||
this().extension()
|
||||
use(::extension)
|
||||
@@ -64,10 +64,10 @@ fun test5() {
|
||||
val <T> T.genericLambda: T.((T) -> Unit) -> Unit get() = {}
|
||||
|
||||
fun test6() {
|
||||
<!INFERRED_INTO_DECLARED_UPPER_BOUNDS!>b<!> {
|
||||
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>b<!> {
|
||||
extension()
|
||||
genericLambda { }
|
||||
genericLambda { it.extension() }
|
||||
use(::extension)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ fun test3() = <!INFERRED_TYPE_VARIABLE_INTO_POSSIBLE_EMPTY_INTERSECTION!>run<!>
|
||||
incompatibleI() // ? either uninferred T or error (Unit </: I)
|
||||
}
|
||||
|
||||
fun test4() = <!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_WARNING!>run<!> {
|
||||
fun test4() = <!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_ERROR!>run<!> {
|
||||
if (p) return@run
|
||||
incompatibleC() // ? either uninferred T or error (Unit </: C)
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -47,7 +47,7 @@ fun test(i: Inv<Nothing>, iUnit: Inv<Unit>) {
|
||||
|
||||
if (iUnit is <!INCOMPATIBLE_TYPES!>String<!>) {
|
||||
launch {
|
||||
run(A.<!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_WARNING!>flexible<!>(iUnit)) { 42 }
|
||||
run(A.<!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_ERROR!>flexible<!>(iUnit)) { 42 }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -20,7 +20,7 @@ object OnlyOne {
|
||||
fun <T : Comparable<T>, S : T> greater(x: Bar<in S>, t: T) {}
|
||||
|
||||
fun test(b: Bar<Long>) {
|
||||
<!DEBUG_INFO_CALL("fqName: OnlyOne.greater; typeCall: function")!><!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_WARNING!>greater<!>(b, b)<!>
|
||||
<!DEBUG_INFO_CALL("fqName: OnlyOne.greater; typeCall: function")!><!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_ERROR!>greater<!>(b, b)<!>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,4 +34,4 @@ object GoodOldCandidate {
|
||||
<!DEBUG_INFO_CALL("fqName: GoodOldCandidate.Nested.greater; typeCall: function")!>greater(b, b)<!>
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-4
@@ -1,6 +1,3 @@
|
||||
/kt45461.kt:5:25: warning: parameter 'foo' is never used
|
||||
fun <S : T> takeFoo(foo: Foo<in S>) {}
|
||||
^
|
||||
/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 1.9
|
||||
/kt45461.kt:10:19: error: type argument for a type parameter S can't be inferred because it has incompatible upper bounds: String, Int (multiple incompatible classes)
|
||||
Bar<String>().takeFoo(foo) // error in 1.3.72, no error in 1.4.31
|
||||
^
|
||||
|
||||
+2
-2
@@ -7,5 +7,5 @@ class Bar<T> {
|
||||
|
||||
fun main() {
|
||||
val foo = Foo<Int>()
|
||||
Bar<String>().<!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_WARNING!>takeFoo<!>(foo) // error in 1.3.72, no error in 1.4.31
|
||||
}
|
||||
Bar<String>().<!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_ERROR!>takeFoo<!>(foo) // error in 1.3.72, no error in 1.4.31
|
||||
}
|
||||
|
||||
+1
-4
@@ -1,7 +1,4 @@
|
||||
/kt45461_12.kt:5:25: warning: parameter 'foo' is never used
|
||||
fun <S : T> takeFoo(foo: Foo<in S>) {}
|
||||
^
|
||||
/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 1.9
|
||||
/kt45461_12.kt:12:19: error: type argument for a type parameter S can't be inferred because it has incompatible upper bounds: String, K (multiple incompatible classes: String, Number)
|
||||
Bar<String>().takeFoo(foo) // error in 1.3.72, no error in 1.4.31
|
||||
^
|
||||
|
||||
|
||||
+1
-1
@@ -9,5 +9,5 @@ interface A
|
||||
|
||||
fun <K : L, L : N, N> main() where N: A, N: Number {
|
||||
val foo = Foo<K>()
|
||||
Bar<String>().<!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_WARNING!>takeFoo<!>(foo) // error in 1.3.72, no error in 1.4.31
|
||||
Bar<String>().<!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_ERROR!>takeFoo<!>(foo) // error in 1.3.72, no error in 1.4.31
|
||||
}
|
||||
|
||||
+1
-7
@@ -1,10 +1,4 @@
|
||||
/kt45461_2.kt:5:25: warning: parameter 'foo' is never used
|
||||
fun <S : T> takeFoo(foo: Foo<in S>) {}
|
||||
^
|
||||
/kt45461_2.kt:8:10: warning: 'Int' is a final type, and thus a value of the type parameter is predetermined
|
||||
fun <K : Int> 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 1.9
|
||||
/kt45461_2.kt:10:19: 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)
|
||||
Bar<String>().takeFoo(foo) // error in 1.3.72, no error in 1.4.31
|
||||
^
|
||||
|
||||
|
||||
+2
-2
@@ -7,5 +7,5 @@ class Bar<T> {
|
||||
|
||||
fun <K : <!FINAL_UPPER_BOUND!>Int<!>> main() {
|
||||
val foo = Foo<K>()
|
||||
Bar<String>().<!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_WARNING!>takeFoo<!>(foo) // error in 1.3.72, no error in 1.4.31
|
||||
}
|
||||
Bar<String>().<!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_ERROR!>takeFoo<!>(foo) // error in 1.3.72, no error in 1.4.31
|
||||
}
|
||||
|
||||
+1
-4
@@ -1,6 +1,3 @@
|
||||
/kt45461_5.kt:5:25: warning: parameter 'foo' is never used
|
||||
fun <S : T> takeFoo(foo: Foo<in S>) {}
|
||||
^
|
||||
/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 1.9
|
||||
/kt45461_5.kt:10:19: error: type argument for a type parameter S can't be inferred because it has incompatible upper bounds: String, K (multiple incompatible classes: String, Number)
|
||||
Bar<String>().takeFoo(foo) // error in 1.3.72, no error in 1.4.31
|
||||
^
|
||||
|
||||
+1
-1
@@ -7,5 +7,5 @@ class Bar<T> {
|
||||
|
||||
fun <K : L, L : N, N: Number> main() {
|
||||
val foo = Foo<K>()
|
||||
Bar<String>().<!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_WARNING!>takeFoo<!>(foo) // error in 1.3.72, no error in 1.4.31
|
||||
Bar<String>().<!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_ERROR!>takeFoo<!>(foo) // error in 1.3.72, no error in 1.4.31
|
||||
}
|
||||
|
||||
+1
-13
@@ -1,16 +1,4 @@
|
||||
/kt48765.kt:4:44: warning: parameter 'x1' is never used
|
||||
fun <T1: Number, T2: A<Float, T1>> foo(x1: T2, x2: T1) {}
|
||||
^
|
||||
/kt48765.kt:4:52: warning: parameter 'x2' is never used
|
||||
fun <T1: Number, T2: A<Float, T1>> 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 1.9
|
||||
/kt48765.kt:8:13: error: type argument for a type parameter T can't be inferred because it has incompatible upper bounds: String, Number (multiple incompatible classes)
|
||||
B().foo(x, foo())
|
||||
^
|
||||
/kt48765.kt:12:9: warning: 'String' is a final type, and thus a value of the type parameter is predetermined
|
||||
fun <T: String> foo(): T {
|
||||
^
|
||||
/kt48765.kt:13:15: warning: unchecked cast: String to T
|
||||
return "" as T // this cast is safe because String is final.
|
||||
^
|
||||
|
||||
|
||||
+2
-2
@@ -5,7 +5,7 @@ class B {
|
||||
}
|
||||
class C<T: D, T2>(val x: T, val y: T2) {
|
||||
fun test() {
|
||||
B().<!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_WARNING!>foo<!>(x, foo())
|
||||
B().<!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_ERROR!>foo<!>(x, foo())
|
||||
}
|
||||
}
|
||||
open class D: A<Float, Number>()
|
||||
@@ -14,4 +14,4 @@ fun <T: <!FINAL_UPPER_BOUND!>String<!>> foo(): T {
|
||||
}
|
||||
fun main() {
|
||||
C(D(), 10.5).test()
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -7,5 +7,5 @@ fun <T, V> exampleGenericFunction(func: V) where T: Base, V: (T) -> Unit {
|
||||
|
||||
fun main() {
|
||||
val func: (DoesNotImplementBase) -> Unit = { }
|
||||
<!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_WARNING!>exampleGenericFunction<!>(func) // expected this to be a compilation error as the T: Base constraint should not be satisfied
|
||||
}
|
||||
<!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_ERROR!>exampleGenericFunction<!>(func) // expected this to be a compilation error as the T: Base constraint should not be satisfied
|
||||
}
|
||||
|
||||
+2
-2
@@ -7,5 +7,5 @@ fun <T, V> exampleGenericFunction(func: V) where T: Base, V: (T) -> Unit {
|
||||
|
||||
fun main() {
|
||||
val func: (DoesNotImplementBase) -> Unit = { }
|
||||
<!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_WARNING!>exampleGenericFunction<!>(func) // expected this to be a compilation error as the T: Base constraint should not be satisfied
|
||||
}
|
||||
<!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_ERROR!>exampleGenericFunction<!>(func) // expected this to be a compilation error as the T: Base constraint should not be satisfied
|
||||
}
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ fun box(): String {
|
||||
return try {
|
||||
val range1 = 0..1
|
||||
range1 <!CAST_NEVER_SUCCEEDS!>as<!> List<Double>
|
||||
<!DEBUG_INFO_SMARTCAST!>range1<!>.<!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_WARNING!>joinToString<!> { "" }
|
||||
<!DEBUG_INFO_SMARTCAST!>range1<!>.<!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_ERROR!>joinToString<!> { "" }
|
||||
} catch (e: java.lang.ClassCastException) {
|
||||
"OK"
|
||||
}
|
||||
|
||||
+1
-1
@@ -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 1.9
|
||||
/kt49661.kt:10:5: error: type argument for a type parameter T can't be inferred because it has incompatible upper bounds: Foo, Int (multiple incompatible classes)
|
||||
f<Int> { g() }
|
||||
^
|
||||
|
||||
|
||||
+2
-2
@@ -7,5 +7,5 @@ inline fun <R> f(block: ()->R?): R? {
|
||||
}
|
||||
|
||||
fun main() {
|
||||
<!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_WARNING!>f<!><Int> { g() }
|
||||
}
|
||||
<!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_ERROR!>f<!><Int> { g() }
|
||||
}
|
||||
|
||||
+2
-2
@@ -12,6 +12,6 @@ fun main() {
|
||||
// val number: Long = 5 // works
|
||||
|
||||
with (WrapperFunctions()) {
|
||||
wrapper <!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_WARNING!>greaterEq<!> number
|
||||
wrapper <!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_ERROR!>greaterEq<!> number
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -9,5 +9,5 @@ infix fun <T : Comparable<T>, S : T?> ExpressionWithColumnType<in S>.less(t: T)
|
||||
infix fun <T : Comparable<T>, S : T?> Expression<in S>.less(other: Expression<in S>) {}
|
||||
|
||||
fun main(x: Column<Long?>, y: Double) {
|
||||
x <!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_WARNING!>less<!> y // error in 1.7.20, no error in 1.7.0
|
||||
x <!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_ERROR!>less<!> y // error in 1.7.20, no error in 1.7.0
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -3,5 +3,5 @@ fun <T : <!FINAL_UPPER_BOUND!>String<!>> g(): T? = null
|
||||
fun <R> f(block: () -> R?): R? = block()
|
||||
|
||||
fun main() {
|
||||
<!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_WARNING!>f<!><Int> { g() /* OK, g() is inferred into {Int & String}? */ }
|
||||
}
|
||||
<!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_ERROR!>f<!><Int> { g() /* OK, g() is inferred into {Int & String}? */ }
|
||||
}
|
||||
|
||||
+1
-10
@@ -1,12 +1,3 @@
|
||||
/selectFromCovariantAndContravariantTypes.kt:10:22: warning: parameter 'y' is never used
|
||||
fun <K> select(x: K, y: K): K = x
|
||||
^
|
||||
/selectFromCovariantAndContravariantTypes.kt:11:19: warning: parameter 'x' is never used
|
||||
fun <V> genericIn(x: In<V>) {}
|
||||
^
|
||||
/selectFromCovariantAndContravariantTypes.kt:12:20: warning: parameter 'x' is never used
|
||||
fun <V> genericOut(x: Out<V>) {}
|
||||
^
|
||||
/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 1.9
|
||||
/selectFromCovariantAndContravariantTypes.kt:15:5: error: type argument for a type parameter V can't be inferred because it has incompatible upper bounds: A, B (multiple incompatible classes)
|
||||
genericIn(select(a, b))
|
||||
^
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ fun <V> genericIn(x: In<V>) {}
|
||||
fun <V> genericOut(x: Out<V>) {}
|
||||
|
||||
fun test1(a: In<A>, b: In<B>) {
|
||||
<!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_WARNING!>genericIn<!>(select(a, b))
|
||||
<!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_ERROR!>genericIn<!>(select(a, b))
|
||||
}
|
||||
|
||||
fun test2(a: Out<A>, b: Out<B>) {
|
||||
|
||||
-71
@@ -1,71 +0,0 @@
|
||||
// WITH_STDLIB
|
||||
// !LANGUAGE: +CustomEqualsInValueClasses
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
@JvmInline
|
||||
value class IC1(val x: Any) {
|
||||
fun <!RESERVED_MEMBER_INSIDE_VALUE_CLASS!>box<!>() {}
|
||||
fun <!RESERVED_MEMBER_INSIDE_VALUE_CLASS!>box<!>(x: Any) {}
|
||||
|
||||
fun <!RESERVED_MEMBER_INSIDE_VALUE_CLASS!>unbox<!>() {}
|
||||
fun <!RESERVED_MEMBER_INSIDE_VALUE_CLASS!>unbox<!>(x: Any) {}
|
||||
|
||||
override fun <!INEFFICIENT_EQUALS_OVERRIDING_IN_VALUE_CLASS!>equals<!>(other: Any?): Boolean = true
|
||||
override fun hashCode(): Int = 0
|
||||
}
|
||||
|
||||
@JvmInline
|
||||
value class IC2(val x: Any) {
|
||||
fun <!RESERVED_MEMBER_INSIDE_VALUE_CLASS!>box<!>(x: Any) {}
|
||||
fun <!RESERVED_MEMBER_INSIDE_VALUE_CLASS!>box<!>(): Any = TODO()
|
||||
|
||||
fun <!RESERVED_MEMBER_INSIDE_VALUE_CLASS!>unbox<!>(x: Any) {}
|
||||
fun <!RESERVED_MEMBER_INSIDE_VALUE_CLASS!>unbox<!>(): Any = TODO()
|
||||
|
||||
fun equals(my: Any, other: Any): Boolean = true
|
||||
fun hashCode(a: Any): Int = 0
|
||||
}
|
||||
|
||||
@JvmInline
|
||||
value class IC3(val x: Any) {
|
||||
fun <!RESERVED_MEMBER_INSIDE_VALUE_CLASS!>box<!>(x: Any): Any = TODO()
|
||||
fun <!RESERVED_MEMBER_INSIDE_VALUE_CLASS!>unbox<!>(x: Any): Any = TODO()
|
||||
|
||||
fun equals(): Boolean = true
|
||||
}
|
||||
|
||||
interface WithBox {
|
||||
fun box(): String
|
||||
}
|
||||
|
||||
@JvmInline
|
||||
value class IC4(val s: String) : WithBox {
|
||||
override fun <!RESERVED_MEMBER_INSIDE_VALUE_CLASS!>box<!>(): String = ""
|
||||
}
|
||||
|
||||
@JvmInline
|
||||
value class IC5(val a: String) {
|
||||
constructor(i: Int) : this(i.toString()) <!SECONDARY_CONSTRUCTOR_WITH_BODY_INSIDE_VALUE_CLASS!>{
|
||||
TODO("something")
|
||||
}<!>
|
||||
}
|
||||
|
||||
@JvmInline
|
||||
value class IC6(val a: String) {
|
||||
fun <!TYPE_PARAMETERS_NOT_ALLOWED!><T><!> equals(other: IC6): Boolean = true
|
||||
}
|
||||
|
||||
@JvmInline
|
||||
value class IC7<T>(val a: String) {
|
||||
fun equals(other: IC7<*>): Boolean = true
|
||||
}
|
||||
|
||||
@JvmInline
|
||||
value class IC8<T>(val a: String) {
|
||||
fun equals(other: <!TYPE_ARGUMENT_ON_TYPED_VALUE_CLASS_EQUALS!>IC8<T><!>): Boolean = true
|
||||
}
|
||||
|
||||
@JvmInline
|
||||
value class IC9<T>(val a: String) {
|
||||
fun equals(other: <!TYPE_ARGUMENT_ON_TYPED_VALUE_CLASS_EQUALS!>IC9<String><!>): Boolean = true
|
||||
}
|
||||
Vendored
+2
-1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// WITH_STDLIB
|
||||
// !LANGUAGE: +CustomEqualsInValueClasses
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
@@ -45,7 +46,7 @@ value class IC4(val s: String) : WithBox {
|
||||
|
||||
@JvmInline
|
||||
value class IC5(val a: String) {
|
||||
constructor(i: Int) : this(i.toString()) <!SECONDARY_CONSTRUCTOR_WITH_BODY_INSIDE_VALUE_CLASS!>{<!>
|
||||
constructor(i: Int) : this(i.toString()) {
|
||||
TODO("something")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
// FIR_DISABLE_LAZY_RESOLVE_CHECKS
|
||||
// FILE: J.java
|
||||
public class J {
|
||||
@Deprecated
|
||||
public void foo() {}
|
||||
}
|
||||
// FILE: J2.java
|
||||
public class J2 extends J implements WithDeprecation {
|
||||
@Override
|
||||
public void foo() {}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
interface WithDeprecation {
|
||||
@Deprecated("")
|
||||
fun foo()
|
||||
}
|
||||
|
||||
class A : J(), WithDeprecation {
|
||||
override fun <!OVERRIDE_DEPRECATION!>foo<!>() {}
|
||||
}
|
||||
|
||||
fun main() {
|
||||
J().<!DEPRECATION!>foo<!>()
|
||||
|
||||
J2().foo()
|
||||
A().foo()
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
// FIR_DISABLE_LAZY_RESOLVE_CHECKS
|
||||
// FIR_IDENTICAL
|
||||
// FILE: J.java
|
||||
public class J {
|
||||
@Deprecated
|
||||
@@ -17,12 +18,12 @@ interface WithDeprecation {
|
||||
}
|
||||
|
||||
class A : J(), WithDeprecation {
|
||||
override fun <!OVERRIDE_DEPRECATION("This deprecation won't be inherited in future releases. ")!>foo<!>() {}
|
||||
override fun <!OVERRIDE_DEPRECATION!>foo<!>() {}
|
||||
}
|
||||
|
||||
fun main() {
|
||||
J().<!DEPRECATION!>foo<!>()
|
||||
|
||||
J2().<!DEPRECATION!>foo<!>()
|
||||
A().<!DEPRECATION!>foo<!>()
|
||||
J2().foo()
|
||||
A().foo()
|
||||
}
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ public class Wrapper<W> {
|
||||
// FILE: test.kt
|
||||
|
||||
fun foo(container: Container<*>, wrapper: Wrapper<String>) {
|
||||
<!TYPE_MISMATCH_WARNING!>container.w = wrapper<!>
|
||||
container.w = <!TYPE_MISMATCH!>wrapper<!>
|
||||
<!SYNTHETIC_SETTER_PROJECTED_OUT!>container.wrapper<!> = wrapper
|
||||
container.setWrapper(<!TYPE_MISMATCH!>wrapper<!>)
|
||||
}
|
||||
|
||||
+1
-1
@@ -9,5 +9,5 @@ interface A : MutableCollection<String> {
|
||||
fun foo(x: MutableCollection<Int>, y: Collection<String>, z: A) {
|
||||
x.<!DEPRECATION!>nonExistingMethod<!>(1).checkType { _<String>() }
|
||||
y.<!DEPRECATION!>nonExistingMethod<!>("")
|
||||
z.<!DEPRECATION!>nonExistingMethod<!>("")
|
||||
z.nonExistingMethod("")
|
||||
}
|
||||
|
||||
Vendored
-125
@@ -1,125 +0,0 @@
|
||||
// !SKIP_JAVAC
|
||||
// !LANGUAGE: +CustomEqualsInValueClasses, +ValueClasses
|
||||
// ALLOW_KOTLIN_PACKAGE
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
package kotlin.jvm
|
||||
|
||||
annotation class JvmInline
|
||||
|
||||
@JvmInline
|
||||
value class IC1(val x: Any) {
|
||||
fun <!RESERVED_MEMBER_INSIDE_VALUE_CLASS!>box<!>() {}
|
||||
fun <!RESERVED_MEMBER_INSIDE_VALUE_CLASS!>box<!>(x: Any) {}
|
||||
|
||||
fun <!RESERVED_MEMBER_INSIDE_VALUE_CLASS!>unbox<!>() {}
|
||||
fun <!RESERVED_MEMBER_INSIDE_VALUE_CLASS!>unbox<!>(x: Any) {}
|
||||
|
||||
override fun <!INEFFICIENT_EQUALS_OVERRIDING_IN_VALUE_CLASS!>equals<!>(other: Any?): Boolean = true
|
||||
override fun hashCode(): Int = 0
|
||||
}
|
||||
|
||||
@JvmInline
|
||||
value class IC2(val x: Any) {
|
||||
fun <!RESERVED_MEMBER_INSIDE_VALUE_CLASS!>box<!>(x: Any) {}
|
||||
fun <!RESERVED_MEMBER_INSIDE_VALUE_CLASS!>box<!>(): Any = TODO()
|
||||
|
||||
fun <!RESERVED_MEMBER_INSIDE_VALUE_CLASS!>unbox<!>(x: Any) {}
|
||||
fun <!RESERVED_MEMBER_INSIDE_VALUE_CLASS!>unbox<!>(): Any = TODO()
|
||||
|
||||
fun equals(my: Any, other: Any): Boolean = true
|
||||
fun hashCode(a: Any): Int = 0
|
||||
}
|
||||
|
||||
@JvmInline
|
||||
value class IC3(val x: Any) {
|
||||
fun <!RESERVED_MEMBER_INSIDE_VALUE_CLASS!>box<!>(x: Any): Any = TODO()
|
||||
fun <!RESERVED_MEMBER_INSIDE_VALUE_CLASS!>unbox<!>(x: Any): Any = TODO()
|
||||
|
||||
fun equals(): Boolean = true
|
||||
}
|
||||
|
||||
interface WithBox {
|
||||
fun box(): String
|
||||
}
|
||||
|
||||
@JvmInline
|
||||
value class IC4(val s: String) : WithBox {
|
||||
override fun <!RESERVED_MEMBER_INSIDE_VALUE_CLASS!>box<!>(): String = ""
|
||||
}
|
||||
|
||||
@JvmInline
|
||||
value class IC5(val a: String) {
|
||||
constructor(i: Int) : this(i.toString()) <!SECONDARY_CONSTRUCTOR_WITH_BODY_INSIDE_VALUE_CLASS!>{
|
||||
TODO("something")
|
||||
}<!>
|
||||
}
|
||||
|
||||
@JvmInline
|
||||
value class IC6(val a: String) {
|
||||
fun <!TYPE_PARAMETERS_NOT_ALLOWED!><T><!> equals(other: IC6): Boolean = true
|
||||
}
|
||||
|
||||
@JvmInline
|
||||
value class MFVC1(val x: Any, val y: Any) {
|
||||
fun <!RESERVED_MEMBER_INSIDE_VALUE_CLASS!>box<!>() {}
|
||||
fun <!RESERVED_MEMBER_INSIDE_VALUE_CLASS!>box<!>(x: Any) {}
|
||||
|
||||
fun <!RESERVED_MEMBER_INSIDE_VALUE_CLASS!>unbox<!>() {}
|
||||
fun <!RESERVED_MEMBER_INSIDE_VALUE_CLASS!>unbox<!>(x: Any) {}
|
||||
|
||||
override fun <!INEFFICIENT_EQUALS_OVERRIDING_IN_VALUE_CLASS!>equals<!>(other: Any?): Boolean = true
|
||||
override fun hashCode(): Int = 0
|
||||
}
|
||||
|
||||
@JvmInline
|
||||
value class MFVC2(val x: Any, val y: Any) {
|
||||
fun <!RESERVED_MEMBER_INSIDE_VALUE_CLASS!>box<!>(x: Any) {}
|
||||
fun <!RESERVED_MEMBER_INSIDE_VALUE_CLASS!>box<!>(): Any = TODO()
|
||||
|
||||
fun <!RESERVED_MEMBER_INSIDE_VALUE_CLASS!>unbox<!>(x: Any) {}
|
||||
fun <!RESERVED_MEMBER_INSIDE_VALUE_CLASS!>unbox<!>(): Any = TODO()
|
||||
|
||||
fun equals(my: Any, other: Any): Boolean = true
|
||||
fun hashCode(a: Any): Int = 0
|
||||
}
|
||||
|
||||
@JvmInline
|
||||
value class MFVC3(val x: Any, val y: Any) {
|
||||
fun <!RESERVED_MEMBER_INSIDE_VALUE_CLASS!>box<!>(x: Any): Any = TODO()
|
||||
fun <!RESERVED_MEMBER_INSIDE_VALUE_CLASS!>unbox<!>(x: Any): Any = TODO()
|
||||
|
||||
fun equals(): Boolean = true
|
||||
}
|
||||
|
||||
@JvmInline
|
||||
value class MFVC4(val s: String, val t: String) : WithBox {
|
||||
override fun <!RESERVED_MEMBER_INSIDE_VALUE_CLASS!>box<!>(): String = ""
|
||||
}
|
||||
|
||||
@JvmInline
|
||||
value class MFVC5(val a: String, val b: String) {
|
||||
constructor(i: Int) : this(i.toString(), "6") <!SECONDARY_CONSTRUCTOR_WITH_BODY_INSIDE_VALUE_CLASS!>{
|
||||
TODO("something")
|
||||
}<!>
|
||||
}
|
||||
|
||||
@JvmInline
|
||||
value class MFVC6(val a: String, val b: String) {
|
||||
fun <!TYPE_PARAMETERS_NOT_ALLOWED!><T><!> equals(other: MFVC6): Boolean = true
|
||||
}
|
||||
|
||||
@JvmInline
|
||||
value class MFVC7<T>(val a: String, val b: String) {
|
||||
fun equals(other: MFVC7<*>): Boolean = true
|
||||
}
|
||||
|
||||
@JvmInline
|
||||
value class MFVC8<T>(val a: String, val b: String) {
|
||||
fun equals(other: <!TYPE_ARGUMENT_ON_TYPED_VALUE_CLASS_EQUALS!>MFVC8<T><!>): Boolean = true
|
||||
}
|
||||
|
||||
@JvmInline
|
||||
value class MFVC9<T>(val a: String, val b: String) {
|
||||
fun equals(other: <!TYPE_ARGUMENT_ON_TYPED_VALUE_CLASS_EQUALS!>MFVC9<String><!>): Boolean = true
|
||||
}
|
||||
+3
-2
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !SKIP_JAVAC
|
||||
// !LANGUAGE: +CustomEqualsInValueClasses, +ValueClasses
|
||||
// ALLOW_KOTLIN_PACKAGE
|
||||
@@ -50,7 +51,7 @@ value class IC4(val s: String) : WithBox {
|
||||
|
||||
@JvmInline
|
||||
value class IC5(val a: String) {
|
||||
constructor(i: Int) : this(i.toString()) <!SECONDARY_CONSTRUCTOR_WITH_BODY_INSIDE_VALUE_CLASS!>{<!>
|
||||
constructor(i: Int) : this(i.toString()) {
|
||||
TODO("something")
|
||||
}
|
||||
}
|
||||
@@ -99,7 +100,7 @@ value class MFVC4(val s: String, val t: String) : WithBox {
|
||||
|
||||
@JvmInline
|
||||
value class MFVC5(val a: String, val b: String) {
|
||||
constructor(i: Int) : this(i.toString(), "6") <!SECONDARY_CONSTRUCTOR_WITH_BODY_INSIDE_VALUE_CLASS!>{<!>
|
||||
constructor(i: Int) : this(i.toString(), "6") {
|
||||
TODO("something")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user