diff --git a/compiler/testData/builtin-classes.txt b/compiler/testData/builtin-classes.txt index 5611beca4ab..4c5416311ac 100644 --- a/compiler/testData/builtin-classes.txt +++ b/compiler/testData/builtin-classes.txt @@ -23,11 +23,11 @@ public final class Array : kotlin.Cloneable { public final class Boolean : kotlin.Comparable { /*primary*/ private constructor Boolean() - public final fun and(/*0*/ other: kotlin.Boolean): kotlin.Boolean + public final infix fun and(/*0*/ other: kotlin.Boolean): kotlin.Boolean public open override /*1*/ fun compareTo(/*0*/ other: kotlin.Boolean): kotlin.Int public final operator fun not(): kotlin.Boolean - public final fun or(/*0*/ other: kotlin.Boolean): kotlin.Boolean - public final fun xor(/*0*/ other: kotlin.Boolean): kotlin.Boolean + public final infix fun or(/*0*/ other: kotlin.Boolean): kotlin.Boolean + public final infix fun xor(/*0*/ other: kotlin.Boolean): kotlin.Boolean } public final class BooleanArray : kotlin.Cloneable { @@ -594,7 +594,7 @@ public interface Function { public final class Int : kotlin.Number, kotlin.Comparable { /*primary*/ private constructor Int() - public final fun and(/*0*/ other: kotlin.Int): kotlin.Int + public final infix fun and(/*0*/ other: kotlin.Int): kotlin.Int public final operator fun compareTo(/*0*/ other: kotlin.Byte): kotlin.Int public final operator fun compareTo(/*0*/ other: kotlin.Double): kotlin.Int public final operator fun compareTo(/*0*/ other: kotlin.Float): kotlin.Int @@ -623,7 +623,7 @@ public final class Int : kotlin.Number, kotlin.Comparable { public final operator fun mod(/*0*/ other: kotlin.Int): kotlin.Int public final operator fun mod(/*0*/ other: kotlin.Long): kotlin.Long public final operator fun mod(/*0*/ other: kotlin.Short): kotlin.Int - public final fun or(/*0*/ other: kotlin.Int): kotlin.Int + public final infix fun or(/*0*/ other: kotlin.Int): kotlin.Int public final operator fun plus(): kotlin.Int public final operator fun plus(/*0*/ other: kotlin.Byte): kotlin.Int public final operator fun plus(/*0*/ other: kotlin.Double): kotlin.Double @@ -637,8 +637,8 @@ public final class Int : kotlin.Number, kotlin.Comparable { public final operator fun rangeTo(/*0*/ other: kotlin.Int): kotlin.IntRange public final operator fun rangeTo(/*0*/ other: kotlin.Long): kotlin.LongRange public final operator fun rangeTo(/*0*/ other: kotlin.Short): kotlin.IntRange - public final fun shl(/*0*/ bits: kotlin.Int): kotlin.Int - public final fun shr(/*0*/ bits: kotlin.Int): kotlin.Int + public final infix fun shl(/*0*/ bits: kotlin.Int): kotlin.Int + public final infix fun shr(/*0*/ bits: kotlin.Int): kotlin.Int public final operator fun times(/*0*/ other: kotlin.Byte): kotlin.Int public final operator fun times(/*0*/ other: kotlin.Double): kotlin.Double public final operator fun times(/*0*/ other: kotlin.Float): kotlin.Float @@ -652,8 +652,8 @@ public final class Int : kotlin.Number, kotlin.Comparable { public open override /*1*/ fun toInt(): kotlin.Int public open override /*1*/ fun toLong(): kotlin.Long public open override /*1*/ fun toShort(): kotlin.Short - public final fun ushr(/*0*/ bits: kotlin.Int): kotlin.Int - public final fun xor(/*0*/ other: kotlin.Int): kotlin.Int + public final infix fun ushr(/*0*/ bits: kotlin.Int): kotlin.Int + public final infix fun xor(/*0*/ other: kotlin.Int): kotlin.Int public companion object Companion : kotlin.IntegerConstants { /*primary*/ private constructor Companion() @@ -770,7 +770,7 @@ public interface ListIterator : kotlin.Iterator { public final class Long : kotlin.Number, kotlin.Comparable { /*primary*/ private constructor Long() - public final fun and(/*0*/ other: kotlin.Long): kotlin.Long + public final infix fun and(/*0*/ other: kotlin.Long): kotlin.Long public final operator fun compareTo(/*0*/ other: kotlin.Byte): kotlin.Int public final operator fun compareTo(/*0*/ other: kotlin.Double): kotlin.Int public final operator fun compareTo(/*0*/ other: kotlin.Float): kotlin.Int @@ -799,7 +799,7 @@ public final class Long : kotlin.Number, kotlin.Comparable { public final operator fun mod(/*0*/ other: kotlin.Int): kotlin.Long public final operator fun mod(/*0*/ other: kotlin.Long): kotlin.Long public final operator fun mod(/*0*/ other: kotlin.Short): kotlin.Long - public final fun or(/*0*/ other: kotlin.Long): kotlin.Long + public final infix fun or(/*0*/ other: kotlin.Long): kotlin.Long public final operator fun plus(): kotlin.Long public final operator fun plus(/*0*/ other: kotlin.Byte): kotlin.Long public final operator fun plus(/*0*/ other: kotlin.Double): kotlin.Double @@ -813,8 +813,8 @@ public final class Long : kotlin.Number, kotlin.Comparable { public final operator fun rangeTo(/*0*/ other: kotlin.Int): kotlin.LongRange public final operator fun rangeTo(/*0*/ other: kotlin.Long): kotlin.LongRange public final operator fun rangeTo(/*0*/ other: kotlin.Short): kotlin.LongRange - public final fun shl(/*0*/ bits: kotlin.Int): kotlin.Long - public final fun shr(/*0*/ bits: kotlin.Int): kotlin.Long + public final infix fun shl(/*0*/ bits: kotlin.Int): kotlin.Long + public final infix fun shr(/*0*/ bits: kotlin.Int): kotlin.Long public final operator fun times(/*0*/ other: kotlin.Byte): kotlin.Long public final operator fun times(/*0*/ other: kotlin.Double): kotlin.Double public final operator fun times(/*0*/ other: kotlin.Float): kotlin.Float @@ -828,8 +828,8 @@ public final class Long : kotlin.Number, kotlin.Comparable { public open override /*1*/ fun toInt(): kotlin.Int public open override /*1*/ fun toLong(): kotlin.Long public open override /*1*/ fun toShort(): kotlin.Short - public final fun ushr(/*0*/ bits: kotlin.Int): kotlin.Long - public final fun xor(/*0*/ other: kotlin.Long): kotlin.Long + public final infix fun ushr(/*0*/ bits: kotlin.Int): kotlin.Long + public final infix fun xor(/*0*/ other: kotlin.Long): kotlin.Long public companion object Companion : kotlin.IntegerConstants { /*primary*/ private constructor Companion() diff --git a/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/infixCall.kt b/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/infixCall.kt index 84a5188e061..edf0b6bdee0 100644 --- a/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/infixCall.kt +++ b/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/infixCall.kt @@ -1,4 +1,4 @@ -tailrec fun Int.test(x : Int) : Int { +tailrec infix fun Int.test(x : Int) : Int { if (this > 1) { return (this - 1) test x } diff --git a/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/infixCall.txt b/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/infixCall.txt index 74585d3c6eb..cce36af9c13 100644 --- a/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/infixCall.txt +++ b/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/infixCall.txt @@ -1,4 +1,4 @@ package public fun box(): kotlin.String -@kotlin.tailrec() public fun kotlin.Int.test(/*0*/ x: kotlin.Int): kotlin.Int +@kotlin.tailrec() public infix fun kotlin.Int.test(/*0*/ x: kotlin.Int): kotlin.Int diff --git a/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/infixRecursiveCall.kt b/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/infixRecursiveCall.kt index ba17e93ec7c..c533885426b 100644 --- a/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/infixRecursiveCall.kt +++ b/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/infixRecursiveCall.kt @@ -1,5 +1,5 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER -tailrec fun Int.foo(x: Int) { +tailrec infix fun Int.foo(x: Int) { if (x == 0) return val xx = x - 1 return 1 foo xx diff --git a/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/infixRecursiveCall.txt b/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/infixRecursiveCall.txt index c2fc2c635d6..76d50de06e3 100644 --- a/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/infixRecursiveCall.txt +++ b/compiler/testData/codegen/box/diagnostics/functions/tailRecursion/infixRecursiveCall.txt @@ -1,4 +1,4 @@ package public fun box(): kotlin.String -@kotlin.tailrec() public fun kotlin.Int.foo(/*0*/ x: kotlin.Int): kotlin.Unit +@kotlin.tailrec() public infix fun kotlin.Int.foo(/*0*/ x: kotlin.Int): kotlin.Unit diff --git a/compiler/testData/diagnostics/tests/AutoCreatedIt.kt b/compiler/testData/diagnostics/tests/AutoCreatedIt.kt index 5e0f4ce9e08..b7f614eba6a 100644 --- a/compiler/testData/diagnostics/tests/AutoCreatedIt.kt +++ b/compiler/testData/diagnostics/tests/AutoCreatedIt.kt @@ -19,14 +19,14 @@ fun bar(f : (Int, Int) -> Int) {} fun bar1(f : (Int) -> Int) {} fun bar2(f : () -> Int) {} -fun String.to(dest : String) { +infix fun String.to(dest : String) { } -fun String.on(predicate : (s : URI) -> Boolean) : URI { +infix fun String.on(predicate : (s : URI) -> Boolean) : URI { return URI(this) } class URI(val body : Any) { - fun to(dest : String) {} + infix fun to(dest : String) {} } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/AutoCreatedIt.txt b/compiler/testData/diagnostics/tests/AutoCreatedIt.txt index 3f8ba6777d5..76a467ded99 100644 --- a/compiler/testData/diagnostics/tests/AutoCreatedIt.txt +++ b/compiler/testData/diagnostics/tests/AutoCreatedIt.txt @@ -4,14 +4,14 @@ public fun bar(/*0*/ f: (kotlin.Int, kotlin.Int) -> kotlin.Int): kotlin.Unit public fun bar1(/*0*/ f: (kotlin.Int) -> kotlin.Int): kotlin.Unit public fun bar2(/*0*/ f: () -> kotlin.Int): kotlin.Unit public fun text(): kotlin.Unit -public fun kotlin.String.on(/*0*/ predicate: (URI) -> kotlin.Boolean): URI -public fun kotlin.String.to(/*0*/ dest: kotlin.String): kotlin.Unit +public infix fun kotlin.String.on(/*0*/ predicate: (URI) -> kotlin.Boolean): URI +public infix fun kotlin.String.to(/*0*/ dest: kotlin.String): kotlin.Unit public final class URI { public constructor URI(/*0*/ body: kotlin.Any) public final val body: kotlin.Any 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 fun to(/*0*/ dest: kotlin.String): kotlin.Unit + public final infix fun to(/*0*/ dest: kotlin.String): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/tests/BinaryCallsOnNullableValues.kt b/compiler/testData/diagnostics/tests/BinaryCallsOnNullableValues.kt index 333670762e6..97a6a39012f 100644 --- a/compiler/testData/diagnostics/tests/BinaryCallsOnNullableValues.kt +++ b/compiler/testData/diagnostics/tests/BinaryCallsOnNullableValues.kt @@ -6,7 +6,7 @@ fun f(): Unit { var x: Int? = 1 x = null x + 1 - x plus 1 + x plus 1 x < 1 x += 1 diff --git a/compiler/testData/diagnostics/tests/Infix.kt b/compiler/testData/diagnostics/tests/Infix.kt index 93e185bb85d..c519a9127a5 100644 --- a/compiler/testData/diagnostics/tests/Infix.kt +++ b/compiler/testData/diagnostics/tests/Infix.kt @@ -8,6 +8,12 @@ class Example { infix fun Example.toExt(other: Example) = Pair(this, other) fun Example.toExtNonInfix(other: Example) = Pair(this, other) +infix fun Example.toExtWithExtraParams(other: Example, blah: Int = 0) = Pair(this, other) +fun Example.toExtNonInfixWithExtraParams(other: Example, blah: Int = 0) = Pair(this, other) + +infix fun Example.toExtDefaultValues(other: Example? = null, blah: Int = 0) = Pair(this, other) +fun Example.toExtNonInfixDefaultValues(other: Example? = null, blah: Int = 0) = Pair(this, other) + fun Example.withLambda(f: () -> Unit) = Pair(this, f) fun test() { @@ -22,5 +28,11 @@ fun test() { a toExtNonInfix b a.toExtNonInfix(b) + a toExtWithExtraParams b + a toExtNonInfixWithExtraParams b + + a toExtDefaultValues b + a toExtNonInfixDefaultValues b + a withLambda { } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/InfixModifierApplicability.kt b/compiler/testData/diagnostics/tests/InfixModifierApplicability.kt index 6a9a5ff9919..f1fc4d6a720 100644 --- a/compiler/testData/diagnostics/tests/InfixModifierApplicability.kt +++ b/compiler/testData/diagnostics/tests/InfixModifierApplicability.kt @@ -5,6 +5,7 @@ infix fun A.to(that: B): Pair = Pair(this, that) infix fun String.o1(o: String) = o infix fun String.o2(o: String, o2: String? = null) = o +infix fun String.o3(o: String = "", o2: String? = null) = o infix fun w1() {} infix fun w2(s: String) {} diff --git a/compiler/testData/diagnostics/tests/dataFlowInfoTraversal/BinaryExpressionIdentifier.kt b/compiler/testData/diagnostics/tests/dataFlowInfoTraversal/BinaryExpressionIdentifier.kt index 8e4be6efa34..8d07b8b532a 100644 --- a/compiler/testData/diagnostics/tests/dataFlowInfoTraversal/BinaryExpressionIdentifier.kt +++ b/compiler/testData/diagnostics/tests/dataFlowInfoTraversal/BinaryExpressionIdentifier.kt @@ -1,5 +1,7 @@ // !CHECK_TYPE +infix fun Int.compareTo(o: Int) = 0 + fun foo(a: Number): Int { val result = (a as Int) compareTo a checkSubtype(a) @@ -10,4 +12,4 @@ fun bar(a: Number): Int { val result = 42 compareTo (a as Int) checkSubtype(a) return result -} +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/dataFlowInfoTraversal/BinaryExpressionIdentifier.txt b/compiler/testData/diagnostics/tests/dataFlowInfoTraversal/BinaryExpressionIdentifier.txt index fdccaf6687a..12461e0b870 100644 --- a/compiler/testData/diagnostics/tests/dataFlowInfoTraversal/BinaryExpressionIdentifier.txt +++ b/compiler/testData/diagnostics/tests/dataFlowInfoTraversal/BinaryExpressionIdentifier.txt @@ -2,3 +2,4 @@ package public fun bar(/*0*/ a: kotlin.Number): kotlin.Int public fun foo(/*0*/ a: kotlin.Number): kotlin.Int +public infix fun kotlin.Int.compareTo(/*0*/ o: kotlin.Int): kotlin.Int diff --git a/compiler/testData/diagnostics/tests/evaluate/numberBinaryOperationsInfixCall.kt b/compiler/testData/diagnostics/tests/evaluate/numberBinaryOperationsInfixCall.kt index 77aedf5c7cc..983c609ff6f 100644 --- a/compiler/testData/diagnostics/tests/evaluate/numberBinaryOperationsInfixCall.kt +++ b/compiler/testData/diagnostics/tests/evaluate/numberBinaryOperationsInfixCall.kt @@ -4,23 +4,23 @@ fun fooByte(p: Byte) = p fun fooShort(p: Short) = p fun test() { - fooInt(1 plus 1) - fooByte(1 plus 1) - fooLong(1 plus 1) - fooShort(1 plus 1) + fooInt(1 plus 1) + fooByte(1 plus 1) + fooLong(1 plus 1) + fooShort(1 plus 1) - fooInt(1 times 1) - fooByte(1 times 1) - fooLong(1 times 1) - fooShort(1 times 1) + fooInt(1 times 1) + fooByte(1 times 1) + fooLong(1 times 1) + fooShort(1 times 1) - fooInt(1 div 1) - fooByte(1 div 1) - fooLong(1 div 1) - fooShort(1 div 1) + fooInt(1 div 1) + fooByte(1 div 1) + fooLong(1 div 1) + fooShort(1 div 1) - fooInt(1 mod 1) - fooByte(1 mod 1) - fooLong(1 mod 1) - fooShort(1 mod 1) + fooInt(1 mod 1) + fooByte(1 mod 1) + fooLong(1 mod 1) + fooShort(1 mod 1) } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/extensions/ExtensionFunctions.kt b/compiler/testData/diagnostics/tests/extensions/ExtensionFunctions.kt index e1054b448c5..c11724ad947 100644 --- a/compiler/testData/diagnostics/tests/extensions/ExtensionFunctions.kt +++ b/compiler/testData/diagnostics/tests/extensions/ExtensionFunctions.kt @@ -16,7 +16,7 @@ fun T.foo(x : E, y : A) : T { class A -operator fun A.plus(a : Any) { +infix operator fun A.plus(a : Any) { 1.foo() true.foo() diff --git a/compiler/testData/diagnostics/tests/extensions/ExtensionFunctions.txt b/compiler/testData/diagnostics/tests/extensions/ExtensionFunctions.txt index 81bc8b32159..e0710a321c7 100644 --- a/compiler/testData/diagnostics/tests/extensions/ExtensionFunctions.txt +++ b/compiler/testData/diagnostics/tests/extensions/ExtensionFunctions.txt @@ -25,7 +25,7 @@ package outer { public fun kotlin.Int.foo(): kotlin.Int public operator fun T.minus(/*0*/ t: T): kotlin.Int public fun kotlin.Int?.optint(): kotlin.Unit - public operator fun outer.A.plus(/*0*/ a: kotlin.Any): kotlin.Unit + public operator infix fun outer.A.plus(/*0*/ a: kotlin.Any): kotlin.Unit public operator fun outer.A.plus(/*0*/ a: kotlin.Int): kotlin.Unit public final class A { diff --git a/compiler/testData/diagnostics/tests/functionLiterals/kt4529.kt b/compiler/testData/diagnostics/tests/functionLiterals/kt4529.kt index 517f4e427b8..00cf35a4f33 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/kt4529.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/kt4529.kt @@ -1,7 +1,7 @@ //KT-4529 Lambdas are analyzed improperly in an infix call nested inside a println class G { - fun foo(bar: (Int) -> Int) = bar + infix fun foo(bar: (Int) -> Int) = bar } fun main(args: Array) { diff --git a/compiler/testData/diagnostics/tests/functionLiterals/kt4529.txt b/compiler/testData/diagnostics/tests/functionLiterals/kt4529.txt index 21ae4e3b210..279882f449d 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/kt4529.txt +++ b/compiler/testData/diagnostics/tests/functionLiterals/kt4529.txt @@ -6,7 +6,7 @@ public fun use(/*0*/ a: kotlin.Any?): kotlin.Any? public final class G { public constructor G() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun foo(/*0*/ bar: (kotlin.Int) -> kotlin.Int): (kotlin.Int) -> kotlin.Int + public final infix fun foo(/*0*/ bar: (kotlin.Int) -> kotlin.Int): (kotlin.Int) -> kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/tests/functionLiterals/kt6541_extensionForExtensionFunction.kt b/compiler/testData/diagnostics/tests/functionLiterals/kt6541_extensionForExtensionFunction.kt index 0475b116d4f..3292e3a15a7 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/kt6541_extensionForExtensionFunction.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/kt6541_extensionForExtensionFunction.kt @@ -4,7 +4,7 @@ interface Foo fun (Foo.() -> Unit).invoke(b : Foo.() -> Unit) {} object Z { - fun add(b : Foo.() -> Unit) : Z = Z + infix fun add(b : Foo.() -> Unit) : Z = Z } val t2 = Z add { } { } diff --git a/compiler/testData/diagnostics/tests/functionLiterals/kt6541_extensionForExtensionFunction.txt b/compiler/testData/diagnostics/tests/functionLiterals/kt6541_extensionForExtensionFunction.txt index 8f9a99c63c8..0e2cb190a69 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/kt6541_extensionForExtensionFunction.txt +++ b/compiler/testData/diagnostics/tests/functionLiterals/kt6541_extensionForExtensionFunction.txt @@ -11,7 +11,7 @@ public interface Foo { public object Z { private constructor Z() - public final fun add(/*0*/ b: Foo.() -> kotlin.Unit): Z + public final infix fun add(/*0*/ b: Foo.() -> kotlin.Unit): Z 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 diff --git a/compiler/testData/diagnostics/tests/inference/commonSystem/fixVariablesInRightOrder.kt b/compiler/testData/diagnostics/tests/inference/commonSystem/fixVariablesInRightOrder.kt index 36a1fcdc553..1e3724fee47 100644 --- a/compiler/testData/diagnostics/tests/inference/commonSystem/fixVariablesInRightOrder.kt +++ b/compiler/testData/diagnostics/tests/inference/commonSystem/fixVariablesInRightOrder.kt @@ -13,5 +13,5 @@ fun test() { // from library class Pair fun mapOf(keyValuePair: Pair): Map = throw Exception() -fun A.to(that: B): Pair = throw Exception() +infix fun A.to(that: B): Pair = throw Exception() diff --git a/compiler/testData/diagnostics/tests/inference/commonSystem/fixVariablesInRightOrder.txt b/compiler/testData/diagnostics/tests/inference/commonSystem/fixVariablesInRightOrder.txt index 93eaf8dc80c..2b8ab1ff5d3 100644 --- a/compiler/testData/diagnostics/tests/inference/commonSystem/fixVariablesInRightOrder.txt +++ b/compiler/testData/diagnostics/tests/inference/commonSystem/fixVariablesInRightOrder.txt @@ -4,7 +4,7 @@ public fun bar(/*0*/ t: T, /*1*/ ext: GenericClass.() -> kotlin.Uni public fun mapOf(/*0*/ keyValuePair: Pair): kotlin.Map public fun test(): kotlin.Unit public fun GenericClass>.foo(): kotlin.Unit -public fun A.to(/*0*/ that: B): Pair +public infix fun A.to(/*0*/ that: B): Pair public final class GenericClass { public constructor GenericClass() diff --git a/compiler/testData/diagnostics/tests/inference/mapFunction.kt b/compiler/testData/diagnostics/tests/inference/mapFunction.kt index 002afc39a71..5717fb0770e 100644 --- a/compiler/testData/diagnostics/tests/inference/mapFunction.kt +++ b/compiler/testData/diagnostics/tests/inference/mapFunction.kt @@ -25,10 +25,10 @@ fun foo() { // --------------------- -// copy from kotlin util +// copy from kotlin util (but with `infix` modifier on `map`) fun array(vararg t : T) : Array = t as Array -fun Array.map(transform : (T) -> R) : List {} +infix fun Array.map(transform : (T) -> R) : List {} -fun Iterable.map(transform : (T) -> R) : List {} \ No newline at end of file +infix fun Iterable.map(transform : (T) -> R) : List {} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/inference/mapFunction.txt b/compiler/testData/diagnostics/tests/inference/mapFunction.txt index bcb41d68574..2ad8f81b7a8 100644 --- a/compiler/testData/diagnostics/tests/inference/mapFunction.txt +++ b/compiler/testData/diagnostics/tests/inference/mapFunction.txt @@ -3,6 +3,6 @@ package package a { public fun array(/*0*/ vararg t: T /*kotlin.Array*/): kotlin.Array public fun foo(): kotlin.Unit - public fun kotlin.Array.map(/*0*/ transform: (T) -> R): kotlin.List - public fun kotlin.Iterable.map(/*0*/ transform: (T) -> R): kotlin.List + public infix fun kotlin.Array.map(/*0*/ transform: (T) -> R): kotlin.List + public infix fun kotlin.Iterable.map(/*0*/ transform: (T) -> R): kotlin.List } diff --git a/compiler/testData/diagnostics/tests/inference/nestedCalls/binaryExpressions.kt b/compiler/testData/diagnostics/tests/inference/nestedCalls/binaryExpressions.kt index c938327b3aa..596a86607ea 100644 --- a/compiler/testData/diagnostics/tests/inference/nestedCalls/binaryExpressions.kt +++ b/compiler/testData/diagnostics/tests/inference/nestedCalls/binaryExpressions.kt @@ -10,7 +10,7 @@ fun id(t: T): T = t //binary expressions //identifier -fun Z.foo(a: A): A = a +infix fun Z.foo(a: A): A = a fun test(z: Z) { z foo newA() diff --git a/compiler/testData/diagnostics/tests/inference/nestedCalls/binaryExpressions.txt b/compiler/testData/diagnostics/tests/inference/nestedCalls/binaryExpressions.txt index 8665c7ff112..2949b66ef14 100644 --- a/compiler/testData/diagnostics/tests/inference/nestedCalls/binaryExpressions.txt +++ b/compiler/testData/diagnostics/tests/inference/nestedCalls/binaryExpressions.txt @@ -13,7 +13,7 @@ package h { public fun use(/*0*/ vararg a: kotlin.Any? /*kotlin.Array*/): kotlin.Array public operator fun h.Z.compareTo(/*0*/ a: h.A): kotlin.Int public fun h.Z.equals(/*0*/ any: kotlin.Any): kotlin.Int - public fun h.Z.foo(/*0*/ a: h.A): h.A + public infix fun h.Z.foo(/*0*/ a: h.A): h.A public operator fun h.Z.plus(/*0*/ a: h.A): h.A public interface A { diff --git a/compiler/testData/diagnostics/tests/inference/nestedCalls/inferenceForNestedBinaryCall.kt b/compiler/testData/diagnostics/tests/inference/nestedCalls/inferenceForNestedBinaryCall.kt index 0e643003412..df887b2f1c3 100644 --- a/compiler/testData/diagnostics/tests/inference/nestedCalls/inferenceForNestedBinaryCall.kt +++ b/compiler/testData/diagnostics/tests/inference/nestedCalls/inferenceForNestedBinaryCall.kt @@ -2,7 +2,7 @@ package aaa -fun T.foo(t: T) = t +infix fun T.foo(t: T) = t fun id(t: T) = t diff --git a/compiler/testData/diagnostics/tests/inference/nestedCalls/inferenceForNestedBinaryCall.txt b/compiler/testData/diagnostics/tests/inference/nestedCalls/inferenceForNestedBinaryCall.txt index 4e374690ec7..0f3c6329118 100644 --- a/compiler/testData/diagnostics/tests/inference/nestedCalls/inferenceForNestedBinaryCall.txt +++ b/compiler/testData/diagnostics/tests/inference/nestedCalls/inferenceForNestedBinaryCall.txt @@ -3,5 +3,5 @@ package package aaa { public fun a(): kotlin.Unit public fun id(/*0*/ t: T): T - public fun T.foo(/*0*/ t: T): T + public infix fun T.foo(/*0*/ t: T): T } diff --git a/compiler/testData/diagnostics/tests/inference/nestedCalls/kt3395.kt b/compiler/testData/diagnostics/tests/inference/nestedCalls/kt3395.kt index 10c73e6f469..f0fe0f47d5f 100644 --- a/compiler/testData/diagnostics/tests/inference/nestedCalls/kt3395.kt +++ b/compiler/testData/diagnostics/tests/inference/nestedCalls/kt3395.kt @@ -10,7 +10,7 @@ public fun query(t: T, args: M fun test(pair: Pair) { val id = "Hello" // variable is marked as unused - println("Some" + query(0, mapOf(id to 1))) + println("Some" + query(0, mapOf(id to 1))) println("Some" + query(0, mapOf(pair))) } @@ -19,7 +19,7 @@ fun test(pair: Pair) { //from standard library fun mapOf(vararg values: Pair): Map { throw Exception() } -fun A.to(that: B): Pair { throw Exception() } +infix fun A.to(that: B): Pair { throw Exception() } fun println(message : Any?) { throw Exception() } diff --git a/compiler/testData/diagnostics/tests/inference/nestedCalls/kt3395.txt b/compiler/testData/diagnostics/tests/inference/nestedCalls/kt3395.txt index 5db538c973d..610ee7fb392 100644 --- a/compiler/testData/diagnostics/tests/inference/nestedCalls/kt3395.txt +++ b/compiler/testData/diagnostics/tests/inference/nestedCalls/kt3395.txt @@ -7,7 +7,7 @@ package b { public fun query(/*0*/ t: T, /*1*/ args: kotlin.Map): kotlin.List public fun test(/*0*/ pair: b.Pair): kotlin.Unit public fun test(/*0*/ t: kotlin.String): kotlin.Unit - public fun A.to(/*0*/ that: B): b.Pair + public infix fun A.to(/*0*/ that: B): b.Pair public final class Pair { public constructor Pair() diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt1029.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt1029.kt index 62d6662f1d0..20da0c58420 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt1029.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt1029.kt @@ -6,7 +6,7 @@ package i public fun from(yielder: ()->Iterable) : Iterable { } -public fun Iterable.where(predicate : (T)->Boolean) : ()->Iterable { +public infix fun Iterable.where(predicate : (T)->Boolean) : ()->Iterable { } fun a() { diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt1029.txt b/compiler/testData/diagnostics/tests/inference/regressions/kt1029.txt index 1e12dbb5ff1..89617f24f82 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt1029.txt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt1029.txt @@ -3,5 +3,5 @@ package package i { public fun a(): kotlin.Unit public fun from(/*0*/ yielder: () -> kotlin.Iterable): kotlin.Iterable - public fun kotlin.Iterable.where(/*0*/ predicate: (T) -> kotlin.Boolean): () -> kotlin.Iterable + public infix fun kotlin.Iterable.where(/*0*/ predicate: (T) -> kotlin.Boolean): () -> kotlin.Iterable } diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt1031.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt1031.kt index 6240a70a77a..c9fdca53736 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt1031.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt1031.kt @@ -5,7 +5,7 @@ package i import java.util.ArrayList -public fun Iterable.where(predicate : (TItem)->Boolean) : ()->Iterable { +public infix fun Iterable.where(predicate : (TItem)->Boolean) : ()->Iterable { } public fun select(yielder: ()->Iterable, selector : (TItem)->TResult) : ()->Iterable { diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt1031.txt b/compiler/testData/diagnostics/tests/inference/regressions/kt1031.txt index 7c0b60efd6f..7a00188f81d 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt1031.txt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt1031.txt @@ -3,5 +3,5 @@ package package i { public fun a(): kotlin.Unit public fun select(/*0*/ yielder: () -> kotlin.Iterable, /*1*/ selector: (TItem) -> TResult): () -> kotlin.Iterable - public fun kotlin.Iterable.where(/*0*/ predicate: (TItem) -> kotlin.Boolean): () -> kotlin.Iterable + public infix fun kotlin.Iterable.where(/*0*/ predicate: (TItem) -> kotlin.Boolean): () -> kotlin.Iterable } diff --git a/compiler/testData/diagnostics/tests/inline/capture.kt b/compiler/testData/diagnostics/tests/inline/capture.kt index 55bd44aa557..5fd271b88ca 100644 --- a/compiler/testData/diagnostics/tests/inline/capture.kt +++ b/compiler/testData/diagnostics/tests/inline/capture.kt @@ -1,8 +1,8 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -NOTHING_TO_INLINE -NON_LOCAL_RETURN_NOT_ALLOWED -fun Function1.noInlineExt(p: Int) {} +infix fun Function1.noInlineExt(p: Int) {} -inline fun Function1.inlineExt2(p: Int) { +inline infix fun Function1.inlineExt2(p: Int) { { noInlineExt(11) this.noInlineExt(11) @@ -25,7 +25,7 @@ inline fun inlineFunWithInvoke(s: (p: Int) -> Unit) { { s(11) s.invoke(11) - s invoke 11 + s invoke 11 }() } @@ -33,7 +33,7 @@ inline fun inlineFunWithInvokeNonInline(noinline s: (p: Int) -> Unit) { { s(11) s.invoke(11) - s invoke 11 + s invoke 11 }() } diff --git a/compiler/testData/diagnostics/tests/inline/capture.txt b/compiler/testData/diagnostics/tests/inline/capture.txt index 23742d23167..ba276daa0ab 100644 --- a/compiler/testData/diagnostics/tests/inline/capture.txt +++ b/compiler/testData/diagnostics/tests/inline/capture.txt @@ -5,5 +5,5 @@ package @kotlin.inline() public fun inlineFunWrongExtension(/*0*/ s: (kotlin.Int) -> kotlin.Unit): kotlin.Unit @kotlin.inline() public fun testExtension(/*0*/ s: (kotlin.Int) -> kotlin.Unit): kotlin.Unit @kotlin.inline() public fun ((kotlin.Int) -> kotlin.Unit).inlineExt(): kotlin.Unit -@kotlin.inline() public fun ((kotlin.Int) -> kotlin.Unit).inlineExt2(/*0*/ p: kotlin.Int): kotlin.Unit -public fun ((kotlin.Int) -> kotlin.Unit).noInlineExt(/*0*/ p: kotlin.Int): kotlin.Unit +@kotlin.inline() public infix fun ((kotlin.Int) -> kotlin.Unit).inlineExt2(/*0*/ p: kotlin.Int): kotlin.Unit +public infix fun ((kotlin.Int) -> kotlin.Unit).noInlineExt(/*0*/ p: kotlin.Int): kotlin.Unit diff --git a/compiler/testData/diagnostics/tests/inline/extensionOnFunction.kt b/compiler/testData/diagnostics/tests/inline/extensionOnFunction.kt index 58f71163cae..3a6d3f50366 100644 --- a/compiler/testData/diagnostics/tests/inline/extensionOnFunction.kt +++ b/compiler/testData/diagnostics/tests/inline/extensionOnFunction.kt @@ -1,8 +1,8 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -NOTHING_TO_INLINE -fun Function1.noInlineExt(p: Int) {} +infix fun Function1.noInlineExt(p: Int) {} -inline fun Function1.inlineExt2(p: Int) { +inline infix fun Function1.inlineExt2(p: Int) { noInlineExt(11) this.noInlineExt(11) this noInlineExt 11 diff --git a/compiler/testData/diagnostics/tests/inline/extensionOnFunction.txt b/compiler/testData/diagnostics/tests/inline/extensionOnFunction.txt index 9aebeeaa5f3..9c6b966fc01 100644 --- a/compiler/testData/diagnostics/tests/inline/extensionOnFunction.txt +++ b/compiler/testData/diagnostics/tests/inline/extensionOnFunction.txt @@ -4,5 +4,5 @@ package @kotlin.inline() public fun inlineFunWrongExtension(/*0*/ s: (kotlin.Int) -> kotlin.Unit): kotlin.Unit @kotlin.inline() public fun testExtension(/*0*/ s: (kotlin.Int) -> kotlin.Unit): kotlin.Unit @kotlin.inline() public fun ((kotlin.Int) -> kotlin.Unit).inlineExt(): kotlin.Unit -@kotlin.inline() public fun ((kotlin.Int) -> kotlin.Unit).inlineExt2(/*0*/ p: kotlin.Int): kotlin.Unit -public fun ((kotlin.Int) -> kotlin.Unit).noInlineExt(/*0*/ p: kotlin.Int): kotlin.Unit +@kotlin.inline() public infix fun ((kotlin.Int) -> kotlin.Unit).inlineExt2(/*0*/ p: kotlin.Int): kotlin.Unit +public infix fun ((kotlin.Int) -> kotlin.Unit).noInlineExt(/*0*/ p: kotlin.Int): kotlin.Unit diff --git a/compiler/testData/diagnostics/tests/inline/invoke.kt b/compiler/testData/diagnostics/tests/inline/invoke.kt index 80db51f666c..d76a596549e 100644 --- a/compiler/testData/diagnostics/tests/inline/invoke.kt +++ b/compiler/testData/diagnostics/tests/inline/invoke.kt @@ -3,24 +3,24 @@ inline fun inlineFunWithInvoke(s: (p: Int) -> Unit, ext: Int.(p: Int) -> Unit) { s(11) s.invoke(11) - s invoke 11 + s invoke 11 11.ext(11) - 11 ext 11 + 11 ext 11 } inline fun inlineFunWithInvokeNonInline(noinline s: (p: Int) -> Unit, ext: Int.(p: Int) -> Unit) { s(11) s.invoke(11) - s invoke 11 + s invoke 11 11.ext(11) - 11 ext 11 + 11 ext 11 } inline fun Function1.inlineExt() { invoke(11) this.invoke(11) - this invoke 11 + this invoke 11 this(11) -} +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/inline/nonLocalReturns/onlyLocalReturnLambdaBinaryExpr.kt b/compiler/testData/diagnostics/tests/inline/nonLocalReturns/onlyLocalReturnLambdaBinaryExpr.kt index c209b5867d0..91a244fe12e 100644 --- a/compiler/testData/diagnostics/tests/inline/nonLocalReturns/onlyLocalReturnLambdaBinaryExpr.kt +++ b/compiler/testData/diagnostics/tests/inline/nonLocalReturns/onlyLocalReturnLambdaBinaryExpr.kt @@ -1,7 +1,7 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -NOTHING_TO_INLINE class Z { - inline fun inlineFun(crossinline p: () -> R) { + inline infix fun inlineFun(crossinline p: () -> R) { p() } } diff --git a/compiler/testData/diagnostics/tests/inline/nonLocalReturns/onlyLocalReturnLambdaBinaryExpr.txt b/compiler/testData/diagnostics/tests/inline/nonLocalReturns/onlyLocalReturnLambdaBinaryExpr.txt index 54576420a72..4063f350520 100644 --- a/compiler/testData/diagnostics/tests/inline/nonLocalReturns/onlyLocalReturnLambdaBinaryExpr.txt +++ b/compiler/testData/diagnostics/tests/inline/nonLocalReturns/onlyLocalReturnLambdaBinaryExpr.txt @@ -8,6 +8,6 @@ public final class Z { public constructor Z() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - @kotlin.inline() public final fun inlineFun(/*0*/ @kotlin.crossinline() p: () -> R): kotlin.Unit + @kotlin.inline() public final infix fun inlineFun(/*0*/ @kotlin.crossinline() p: () -> R): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/tests/inline/parenthesized.kt b/compiler/testData/diagnostics/tests/inline/parenthesized.kt index eadaa818410..8eb98c0b647 100644 --- a/compiler/testData/diagnostics/tests/inline/parenthesized.kt +++ b/compiler/testData/diagnostics/tests/inline/parenthesized.kt @@ -3,13 +3,13 @@ inline fun inlineFunWithInvoke(s: (p: Int) -> Unit) { (s)(11) (s).invoke(11) - (s) invoke 11 + (s) invoke 11 (s) } inline fun Function1.inlineExt() { (this).invoke(11) - (this) invoke 11 + (this) invoke 11 (this)(11) (this) } @@ -17,7 +17,7 @@ inline fun Function1.inlineExt() { inline fun inlineFunWithInvoke2(s: (p: Int) -> Unit) { (((s)))(11) (((s))).invoke(11) - (((s))) invoke 11 + (((s))) invoke 11 (((s))) } diff --git a/compiler/testData/diagnostics/tests/inline/sam.kt b/compiler/testData/diagnostics/tests/inline/sam.kt index 845263fd63b..f20181901d1 100644 --- a/compiler/testData/diagnostics/tests/inline/sam.kt +++ b/compiler/testData/diagnostics/tests/inline/sam.kt @@ -17,10 +17,10 @@ inline fun inlineFunWithInvoke(s: (p: Int) -> Unit, ext: Int.(p: Int) -> Unit) { Test().test(){ s(11) s.invoke(11) - s invoke 11 + s invoke 11 11.ext(11) - 11 ext 11 + 11 ext 11 s ext @@ -32,10 +32,10 @@ inline fun inlineFunWithInvokeNonInline(noinline s: (p: Int) -> Unit, ext: Int.( Test().test(){ s(11) s.invoke(11) - s invoke 11 + s invoke 11 11.ext(11) - 11 ext 11 + 11 ext 11 s ext @@ -48,7 +48,7 @@ inline fun Function1.inlineExt() { Test().test(){ invoke(11) this.invoke(11) - this invoke 11 + this invoke 11 this(11) this diff --git a/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/InfixCallNullability.kt b/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/InfixCallNullability.kt index a124f892048..fec32c10412 100644 --- a/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/InfixCallNullability.kt +++ b/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/InfixCallNullability.kt @@ -1,16 +1,15 @@ class A() { - operator fun plus(i : Int) {} + operator infix fun plus(i : Int) {} operator fun minus() {} - operator fun contains(a : Any?) : Boolean = true + operator infix fun contains(a : Any?) : Boolean = true } -operator fun A.div(i : Int) {} -operator fun A?.times(i : Int) {} +operator infix fun A.div(i : Int) {} +operator infix fun A?.times(i : Int) {} fun test(x : Int?, a : A?) { x.plus(1) x?.plus(1) - x plus 1 x + 1 -x x.minus() diff --git a/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/InfixCallNullability.txt b/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/InfixCallNullability.txt index 3646a244fce..59fba32b8d3 100644 --- a/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/InfixCallNullability.txt +++ b/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/InfixCallNullability.txt @@ -1,15 +1,15 @@ package public fun test(/*0*/ x: kotlin.Int?, /*1*/ a: A?): kotlin.Unit -public operator fun A.div(/*0*/ i: kotlin.Int): kotlin.Unit -public operator fun A?.times(/*0*/ i: kotlin.Int): kotlin.Unit +public operator infix fun A.div(/*0*/ i: kotlin.Int): kotlin.Unit +public operator infix fun A?.times(/*0*/ i: kotlin.Int): kotlin.Unit public final class A { public constructor A() - public final operator fun contains(/*0*/ a: kotlin.Any?): kotlin.Boolean + public final operator infix fun contains(/*0*/ a: kotlin.Any?): kotlin.Boolean 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 minus(): kotlin.Unit - public final operator fun plus(/*0*/ i: kotlin.Int): kotlin.Unit + public final operator infix fun plus(/*0*/ i: kotlin.Int): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/tests/operatorsOverloading/kt3450.kt b/compiler/testData/diagnostics/tests/operatorsOverloading/kt3450.kt index e8945dbb4c1..1c7670478e3 100644 --- a/compiler/testData/diagnostics/tests/operatorsOverloading/kt3450.kt +++ b/compiler/testData/diagnostics/tests/operatorsOverloading/kt3450.kt @@ -20,4 +20,4 @@ val x = B()["a", "v"]["a" to "b"] {} ["q" to "p"] // does not parses around {} //from library data class Pair (val first: A, val second: B) -fun A.to(that: B) = Pair(this, that) \ No newline at end of file +infix fun A.to(that: B) = Pair(this, that) \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/operatorsOverloading/kt3450.txt b/compiler/testData/diagnostics/tests/operatorsOverloading/kt3450.txt index 8f0037df299..dce1dc05ab7 100644 --- a/compiler/testData/diagnostics/tests/operatorsOverloading/kt3450.txt +++ b/compiler/testData/diagnostics/tests/operatorsOverloading/kt3450.txt @@ -4,7 +4,7 @@ public val x: B public fun test(): kotlin.Unit public operator fun A.div(/*0*/ s: kotlin.String): A public operator fun kotlin.String.plus(): A -public fun A.to(/*0*/ that: B): Pair +public infix fun A.to(/*0*/ that: B): Pair public final class A { public constructor A() diff --git a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/arithmetic.kt b/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/arithmetic.kt index 92006839405..26ad2b48d8b 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/arithmetic.kt +++ b/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/arithmetic.kt @@ -40,16 +40,15 @@ fun test() { platformN + 1 platformJ + 1 - 1 plus platformNN + 1 plus platformNN 1 plus platformN - 1 plus platformJ + 1 plus platformJ - platformNN plus 1 - platformN plus 1 - platformJ plus 1 + platformNN plus 1 + platformN plus 1 + platformJ plus 1 platformNN += 1 platformN += 1 platformJ += 1 -} - +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/regressions/kt385.109.441.kt b/compiler/testData/diagnostics/tests/regressions/kt385.109.441.kt index 7045ffb6802..6a201f85e14 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt385.109.441.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt385.109.441.kt @@ -4,9 +4,9 @@ import java.util.* -fun Iterator.foreach(operation: (element: T) -> Unit) : Unit { while(hasNext()) operation(next()) } +infix fun Iterator.foreach(operation: (element: T) -> Unit) : Unit { while(hasNext()) operation(next()) } -fun Iterator.foreach(operation: (index: Int, element: T) -> Unit) : Unit { +infix fun Iterator.foreach(operation: (index: Int, element: T) -> Unit) : Unit { var k = 0 while(hasNext()) operation(k++, next()) diff --git a/compiler/testData/diagnostics/tests/regressions/kt385.109.441.txt b/compiler/testData/diagnostics/tests/regressions/kt385.109.441.txt index b7c391432b4..5040571b965 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt385.109.441.txt +++ b/compiler/testData/diagnostics/tests/regressions/kt385.109.441.txt @@ -8,5 +8,5 @@ public fun println(/*0*/ message: kotlin.Long): kotlin.Unit @kotlin.inline() public fun run(/*0*/ body: () -> T): T public fun kotlin.Iterable.foreach(/*0*/ operation: (T) -> kotlin.Unit): kotlin.Unit public fun kotlin.Iterable.foreach(/*0*/ operation: (kotlin.Int, T) -> kotlin.Unit): kotlin.Unit -public fun kotlin.Iterator.foreach(/*0*/ operation: (T) -> kotlin.Unit): kotlin.Unit -public fun kotlin.Iterator.foreach(/*0*/ operation: (kotlin.Int, T) -> kotlin.Unit): kotlin.Unit +public infix fun kotlin.Iterator.foreach(/*0*/ operation: (T) -> kotlin.Unit): kotlin.Unit +public infix fun kotlin.Iterator.foreach(/*0*/ operation: (kotlin.Int, T) -> kotlin.Unit): kotlin.Unit diff --git a/compiler/testData/diagnostics/tests/regressions/kt442.kt b/compiler/testData/diagnostics/tests/regressions/kt442.kt index c09cca93b3f..887d48959e0 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt442.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt442.kt @@ -20,7 +20,7 @@ fun generic_invoker(gen : (String) -> T) : T { return gen("") } -fun T.with(f : T.() -> Unit) { +infix fun T.with(f : T.() -> Unit) { f() } diff --git a/compiler/testData/diagnostics/tests/regressions/kt442.txt b/compiler/testData/diagnostics/tests/regressions/kt442.txt index 4ec35e8db58..25db33cd53e 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt442.txt +++ b/compiler/testData/diagnostics/tests/regressions/kt442.txt @@ -7,4 +7,4 @@ public fun generic_invoker(/*0*/ gen: (kotlin.String) -> T): T public fun main(/*0*/ args: kotlin.Array): kotlin.Unit public fun testFunny(): kotlin.Unit public fun testFunny2(): kotlin.Unit -public fun T.with(/*0*/ f: T.() -> kotlin.Unit): kotlin.Unit +public infix fun T.with(/*0*/ f: T.() -> kotlin.Unit): kotlin.Unit diff --git a/compiler/testData/diagnostics/tests/smartCasts/afterBinaryExpr.kt b/compiler/testData/diagnostics/tests/smartCasts/afterBinaryExpr.kt index 09854d7cdf4..71aea3b88f6 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/afterBinaryExpr.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/afterBinaryExpr.kt @@ -1,7 +1,7 @@ package o class A { - fun foo(b: B) = b + infix fun foo(b: B) = b } class B { diff --git a/compiler/testData/diagnostics/tests/smartCasts/afterBinaryExpr.txt b/compiler/testData/diagnostics/tests/smartCasts/afterBinaryExpr.txt index 461d7351cd7..c6687274428 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/afterBinaryExpr.txt +++ b/compiler/testData/diagnostics/tests/smartCasts/afterBinaryExpr.txt @@ -6,7 +6,7 @@ package o { public final class A { public constructor A() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun foo(/*0*/ b: o.B): o.B + public final infix fun foo(/*0*/ b: o.B): o.B public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/tests/smartCasts/inference/smartCastOnReceiver.kt b/compiler/testData/diagnostics/tests/smartCasts/inference/smartCastOnReceiver.kt index 99427844d31..87f51c9338a 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/inference/smartCastOnReceiver.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/inference/smartCastOnReceiver.kt @@ -10,4 +10,4 @@ class Test { } class Pair(val first: A, val second: B) -fun A.to(that: B) = Pair(this, that) \ No newline at end of file +infix fun A.to(that: B) = Pair(this, that) \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/smartCasts/inference/smartCastOnReceiver.txt b/compiler/testData/diagnostics/tests/smartCasts/inference/smartCastOnReceiver.txt index 611bb1bca39..53a25fbd224 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/inference/smartCastOnReceiver.txt +++ b/compiler/testData/diagnostics/tests/smartCasts/inference/smartCastOnReceiver.txt @@ -1,6 +1,6 @@ package -public fun A.to(/*0*/ that: B): Pair +public infix fun A.to(/*0*/ that: B): Pair public interface A { public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean diff --git a/compiler/testData/diagnostics/tests/smartCasts/kt3711.kt b/compiler/testData/diagnostics/tests/smartCasts/kt3711.kt index 86ac84fc969..db7a36d3b9b 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/kt3711.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/kt3711.kt @@ -1,6 +1,6 @@ data class StringPair(val first: String, val second: String) -fun String.to(second: String) = StringPair(this, second) +infix fun String.to(second: String) = StringPair(this, second) fun f(a: String?) { if (a != null) { diff --git a/compiler/testData/diagnostics/tests/smartCasts/kt3711.txt b/compiler/testData/diagnostics/tests/smartCasts/kt3711.txt index 815dd3b0dfc..7076b7b05f9 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/kt3711.txt +++ b/compiler/testData/diagnostics/tests/smartCasts/kt3711.txt @@ -1,7 +1,7 @@ package public fun f(/*0*/ a: kotlin.String?): kotlin.Unit -public fun kotlin.String.to(/*0*/ second: kotlin.String): StringPair +public infix fun kotlin.String.to(/*0*/ second: kotlin.String): StringPair @kotlin.data() public final class StringPair { public constructor StringPair(/*0*/ first: kotlin.String, /*1*/ second: kotlin.String) diff --git a/compiler/testData/diagnostics/tests/smartCasts/kt3899.kt b/compiler/testData/diagnostics/tests/smartCasts/kt3899.kt index be164c3d6d8..2a3b7c0ae86 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/kt3899.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/kt3899.kt @@ -1,6 +1,6 @@ data class StringPair(val first: String, val second: String) -fun String.to(second: String) = StringPair(this, second) +infix fun String.to(second: String) = StringPair(this, second) fun hashMapOf(pair: StringPair): MutableMap { } diff --git a/compiler/testData/diagnostics/tests/smartCasts/kt3899.txt b/compiler/testData/diagnostics/tests/smartCasts/kt3899.txt index 357936f623f..bfc97629990 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/kt3899.txt +++ b/compiler/testData/diagnostics/tests/smartCasts/kt3899.txt @@ -2,7 +2,7 @@ package public fun F(): kotlin.MutableMap public fun hashMapOf(/*0*/ pair: StringPair): kotlin.MutableMap -public fun kotlin.String.to(/*0*/ second: kotlin.String): StringPair +public infix fun kotlin.String.to(/*0*/ second: kotlin.String): StringPair @kotlin.data() public final class StringPair { public constructor StringPair(/*0*/ first: kotlin.String, /*1*/ second: kotlin.String) diff --git a/compiler/testData/diagnostics/tests/smartCasts/publicVals/open.kt b/compiler/testData/diagnostics/tests/smartCasts/publicVals/open.kt index d1e1267658f..770e1fcca6a 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/publicVals/open.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/publicVals/open.kt @@ -2,7 +2,7 @@ public open class A() { public open val foo: Int? = 1 } -fun Int.bar(i: Int) = i +infix fun Int.bar(i: Int) = i fun test() { val p = A() diff --git a/compiler/testData/diagnostics/tests/smartCasts/publicVals/open.txt b/compiler/testData/diagnostics/tests/smartCasts/publicVals/open.txt index 60b77df2d92..710c3753670 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/publicVals/open.txt +++ b/compiler/testData/diagnostics/tests/smartCasts/publicVals/open.txt @@ -1,7 +1,7 @@ package public fun test(): kotlin.Unit -public fun kotlin.Int.bar(/*0*/ i: kotlin.Int): kotlin.Int +public infix fun kotlin.Int.bar(/*0*/ i: kotlin.Int): kotlin.Int public open class A { public constructor A() diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/BaseDiagnosticsTest.java b/compiler/tests/org/jetbrains/kotlin/checkers/BaseDiagnosticsTest.java index 34c2169d33e..03f35a72029 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/BaseDiagnosticsTest.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/BaseDiagnosticsTest.java @@ -68,7 +68,7 @@ public abstract class BaseDiagnosticsTest extends "\nfun checkSubtype(t: T) = t" + "\nclass Inv" + "\nfun Inv._() {}" + - "\nfun T.checkType(f: Inv.() -> Unit) {}"; + "\ninfix fun T.checkType(f: Inv.() -> Unit) {}"; public static final String CHECK_TYPE_IMPORT = "import " + CHECK_TYPE_PACKAGE + ".*"; public static final String EXPLICIT_FLEXIBLE_TYPES_DIRECTIVE = "EXPLICIT_FLEXIBLE_TYPES"; diff --git a/idea/testData/checker/BinaryCallsOnNullableValues.kt b/idea/testData/checker/BinaryCallsOnNullableValues.kt index 4342a082341..825c8769df2 100644 --- a/idea/testData/checker/BinaryCallsOnNullableValues.kt +++ b/idea/testData/checker/BinaryCallsOnNullableValues.kt @@ -6,7 +6,7 @@ fun f(): Unit { var x: Int? = 1 x = 1 x + 1 - x plus 1 + x.plus(1) x < 1 x += 1 diff --git a/idea/testData/checker/ExtensionFunctions.kt b/idea/testData/checker/ExtensionFunctions.kt index c5113158532..b9f516263b0 100644 --- a/idea/testData/checker/ExtensionFunctions.kt +++ b/idea/testData/checker/ExtensionFunctions.kt @@ -13,7 +13,7 @@ fun T.foo(x : E, y : A) : T { class A -operator fun A.plus(a : Any) { +infix operator fun A.plus(a : Any) { 1.foo() true.foo() @@ -21,7 +21,7 @@ operator fun A.plus(a : Any) { 1 } -operator fun A.plus(a : Int) { +infix operator fun A.plus(a : Int) { 1 } diff --git a/idea/testData/checker/rendering/TypeInferenceError.kt b/idea/testData/checker/rendering/TypeInferenceError.kt index ac769f3af89..d82b2759194 100644 --- a/idea/testData/checker/rendering/TypeInferenceError.kt +++ b/idea/testData/checker/rendering/TypeInferenceError.kt @@ -7,5 +7,5 @@ fun foo() { //extract from library fun hashMap(p: Pair): MutableMap {} -fun K.to(v: V): Pair {} +infix fun K.to(v: V): Pair {} class Pair {} \ No newline at end of file