[FE 1.0] Implement checker to detect changed resolve for progressions and ranges due to the start of implementing Collection<T>

^KT-49276 Fixed
This commit is contained in:
Victor Petukhov
2021-11-30 14:47:17 +03:00
committed by teamcity
parent 4363667bc1
commit 7475d26902
25 changed files with 588 additions and 18 deletions
@@ -0,0 +1,43 @@
// WITH_RUNTIME
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
}
@@ -0,0 +1,43 @@
// WITH_RUNTIME
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(<!PROGRESSIONS_CHANGING_RESOLVE_WARNING("fun <E> SmartList(x: Collection<E>): Unit")!>1..2<!>) // warning
SmartList<IntRange>(1..10) // no warning
append(<!PROGRESSIONS_CHANGING_RESOLVE_WARNING("fun append(x: Collection<*>): Unit")!>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(<!PROGRESSIONS_CHANGING_RESOLVE_WARNING("fun <E : Collection<*>> append4(x: E): Unit")!>1..10<!>) // warning
append4<IntRange>(1..10) // warning
takes(<!PROGRESSIONS_CHANGING_RESOLVE_WARNING("fun <T : Collection<*>> takes(range: T): Unit where T : ClosedRange<*>")!>1..10<!>) // warning
}
@@ -0,0 +1,23 @@
package
public fun </*0*/ E> SmartList(/*0*/ x: E): kotlin.Unit
public fun </*0*/ E> SmartList(/*0*/ x: kotlin.collections.Collection<E>): kotlin.Unit
public fun append(/*0*/ x: kotlin.Any?): kotlin.Unit
public fun append(/*0*/ x: kotlin.collections.Collection<*>): kotlin.Unit
public fun append2(/*0*/ x: kotlin.collections.Collection<*>): kotlin.Unit
public fun append2(/*0*/ x: kotlin.collections.Iterable<*>): kotlin.Unit
@kotlin.jvm.JvmName(name = "append31") public fun append3(/*0*/ x: In<kotlin.Nothing>): kotlin.Unit
public fun append3(/*0*/ x: In<kotlin.collections.Collection<*>>): kotlin.Unit
public fun </*0*/ E> append4(/*0*/ x: E): kotlin.Unit
public fun </*0*/ E : kotlin.collections.Collection<*>> append4(/*0*/ x: E): kotlin.Unit
public fun main(): kotlin.Unit
public fun </*0*/ T> takes(/*0*/ range: T): kotlin.Unit
public fun </*0*/ T : kotlin.collections.Collection<*>> takes(/*0*/ range: T): kotlin.Unit where T : kotlin.ranges.ClosedRange<*>
public final class In</*0*/ in T> {
public constructor In</*0*/ in T>(/*0*/ x: T)
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@@ -0,0 +1,38 @@
// FIR_IDENTICAL
// !LANGUAGE: +DisableCheckingChangedProgressionsResolve
// WITH_RUNTIME
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
}
@@ -0,0 +1,20 @@
package
public fun </*0*/ E> SmartList(/*0*/ x: E): kotlin.Unit
public fun </*0*/ E> SmartList(/*0*/ x: kotlin.collections.Collection<E>): kotlin.Unit
public fun append(/*0*/ x: kotlin.Any?): kotlin.Unit
public fun append(/*0*/ x: kotlin.collections.Collection<*>): kotlin.Unit
public fun append2(/*0*/ x: kotlin.collections.Collection<*>): kotlin.Unit
public fun append2(/*0*/ x: kotlin.collections.Iterable<*>): kotlin.Unit
@kotlin.jvm.JvmName(name = "append31") public fun append3(/*0*/ x: In<kotlin.Nothing>): kotlin.Unit
public fun append3(/*0*/ x: In<kotlin.collections.Collection<*>>): kotlin.Unit
public fun </*0*/ E> append4(/*0*/ x: E): kotlin.Unit
public fun </*0*/ E : kotlin.collections.Collection<*>> append4(/*0*/ x: E): kotlin.Unit
public fun main(): kotlin.Unit
public final class In</*0*/ in T> {
public constructor In</*0*/ in T>(/*0*/ x: T)
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@@ -0,0 +1,37 @@
// WITH_RUNTIME
// !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
}
@@ -0,0 +1,37 @@
// WITH_RUNTIME
// !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(<!PROGRESSIONS_CHANGING_RESOLVE_ERROR("fun <E> SmartList(x: Collection<E>): Unit")!>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) 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(<!PROGRESSIONS_CHANGING_RESOLVE_ERROR("fun <E : Collection<*>> append4(x: E): Unit")!>1..10<!>) // warning
}
@@ -0,0 +1,20 @@
package
public fun </*0*/ E> SmartList(/*0*/ x: E): kotlin.Unit
public fun </*0*/ E> SmartList(/*0*/ x: kotlin.collections.Collection<E>): kotlin.Unit
public fun append(/*0*/ x: kotlin.Any?): kotlin.Unit
public fun append(/*0*/ x: kotlin.collections.Collection<*>): kotlin.Unit
public fun append2(/*0*/ x: kotlin.collections.Collection<*>): kotlin.Unit
public fun append2(/*0*/ x: kotlin.collections.Iterable<*>): kotlin.Unit
@kotlin.jvm.JvmName(name = "append31") public fun append3(/*0*/ x: In<kotlin.Nothing>): kotlin.Unit
public fun append3(/*0*/ x: In<kotlin.collections.Collection<*>>): kotlin.Unit
public fun </*0*/ E> append4(/*0*/ x: E): kotlin.Unit
public fun </*0*/ E : kotlin.collections.Collection<*>> append4(/*0*/ x: E): kotlin.Unit
public fun main(): kotlin.Unit
public final class In</*0*/ in T> {
public constructor In</*0*/ in T>(/*0*/ x: T)
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}