[FE 1.0] Introduce "range until operator" language feature, and report errors on its usages till 1.8

This commit is contained in:
Victor Petukhov
2022-05-24 11:45:04 +02:00
committed by teamcity
parent de9d1dc536
commit c266303197
16 changed files with 136 additions and 2 deletions
@@ -1,3 +1,6 @@
// FIR_IDENTICAL
// !LANGUAGE: +RangeUntilOperator
class A {
operator fun rangeUntil(other: A): Iterable<A> = TODO()
}
@@ -0,0 +1,9 @@
class A {
operator fun rangeUntil(other: A): Iterable<A> = TODO()
}
fun main(n: A, f: A) {
for (i in f<!UNSUPPORTED_FEATURE("The feature "range until operator" is only available since language version 1.8")!>..<<!>n) {
}
}
@@ -0,0 +1,11 @@
package
public fun main(/*0*/ n: A, /*1*/ f: A): kotlin.Unit
public final class A {
public constructor A()
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 final operator fun rangeUntil(/*0*/ other: A): kotlin.collections.Iterable<A>
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@@ -0,0 +1,11 @@
// !LANGUAGE: -RangeUntilOperator
class A {
operator fun rangeUntil(other: A): Iterable<A> = TODO()
}
fun main(n: A, f: A) {
for (i in f..<n) {
}
}
@@ -0,0 +1,11 @@
// !LANGUAGE: -RangeUntilOperator
class A {
operator fun rangeUntil(other: A): Iterable<A> = TODO()
}
fun main(n: A, f: A) {
for (i in f<!UNSUPPORTED_FEATURE("The feature "range until operator" is only available since language version 1.8")!>..<<!>n) {
}
}
@@ -0,0 +1,11 @@
package
public fun main(/*0*/ n: A, /*1*/ f: A): kotlin.Unit
public final class A {
public constructor A()
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 final operator fun rangeUntil(/*0*/ other: A): kotlin.collections.Iterable<A>
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@@ -1,3 +1,5 @@
// !LANGUAGE: +RangeUntilOperator
fun main(n: Int) {
for (i in <!ITERATOR_MISSING!>0<!UNRESOLVED_REFERENCE!>..<<!>n<!>) {
@@ -1,3 +1,5 @@
// !LANGUAGE: +RangeUntilOperator
fun main(n: Int) {
for (i in 0<!UNRESOLVED_REFERENCE!>..<<!>n) {