[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,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
}