Fix tests ('infix')

This commit is contained in:
Yan Zhulanow
2015-09-30 21:27:45 +03:00
parent 7e8674c6ee
commit 1b01e7a85a
65 changed files with 146 additions and 132 deletions
+15 -15
View File
@@ -23,11 +23,11 @@ public final class Array</*0*/ reified T> : kotlin.Cloneable {
public final class Boolean : kotlin.Comparable<kotlin.Boolean> {
/*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</*0*/ out R> {
public final class Int : kotlin.Number, kotlin.Comparable<kotlin.Int> {
/*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<kotlin.Int> {
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<kotlin.Int> {
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<kotlin.Int> {
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<kotlin.Int> {
/*primary*/ private constructor Companion()
@@ -770,7 +770,7 @@ public interface ListIterator</*0*/ out T> : kotlin.Iterator<T> {
public final class Long : kotlin.Number, kotlin.Comparable<kotlin.Long> {
/*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<kotlin.Long> {
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<kotlin.Long> {
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<kotlin.Long> {
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<kotlin.Long> {
/*primary*/ private constructor Companion()
@@ -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
}
@@ -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
@@ -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
@@ -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
+3 -3
View File
@@ -19,14 +19,14 @@ fun bar(<!UNUSED_PARAMETER!>f<!> : (Int, Int) -> Int) {}
fun bar1(<!UNUSED_PARAMETER!>f<!> : (Int) -> Int) {}
fun bar2(<!UNUSED_PARAMETER!>f<!> : () -> Int) {}
fun String.to(<!UNUSED_PARAMETER!>dest<!> : String) {
infix fun String.to(<!UNUSED_PARAMETER!>dest<!> : String) {
}
fun String.on(<!UNUSED_PARAMETER!>predicate<!> : (s : URI) -> Boolean) : URI {
infix fun String.on(<!UNUSED_PARAMETER!>predicate<!> : (s : URI) -> Boolean) : URI {
return URI(this)
}
class URI(val body : Any) {
fun to(<!UNUSED_PARAMETER!>dest<!> : String) {}
infix fun to(<!UNUSED_PARAMETER!>dest<!> : String) {}
}
+3 -3
View File
@@ -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
}
@@ -6,7 +6,7 @@ fun f(): Unit {
var x: Int? = <!VARIABLE_WITH_REDUNDANT_INITIALIZER!>1<!>
x = null
x <!UNSAFE_INFIX_CALL!>+<!> 1
x <!UNSAFE_INFIX_CALL!>plus<!> 1
x <!UNSAFE_INFIX_CALL, INFIX_MODIFIER_REQUIRED!>plus<!> 1
x <!UNSAFE_INFIX_CALL!><<!> 1
x <!UNSAFE_INFIX_CALL!>+=<!> 1
+12
View File
@@ -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 <!INFIX_MODIFIER_REQUIRED!>toExtNonInfix<!> b
a.toExtNonInfix(b)
a toExtWithExtraParams b
a <!INFIX_MODIFIER_REQUIRED!>toExtNonInfixWithExtraParams<!> b
a toExtDefaultValues b
a <!INFIX_MODIFIER_REQUIRED!>toExtNonInfixDefaultValues<!> b
a <!INFIX_MODIFIER_REQUIRED!>withLambda<!> { }
}
@@ -5,6 +5,7 @@ infix fun <A, B> A.to(that: B): Pair<A, B> = 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
<!INAPPLICABLE_INFIX_MODIFIER!>infix<!> fun w1() {}
<!INAPPLICABLE_INFIX_MODIFIER!>infix<!> fun w2(s: String) {}
@@ -1,5 +1,7 @@
// !CHECK_TYPE
infix fun Int.compareTo(<!UNUSED_PARAMETER!>o<!>: Int) = 0
fun foo(a: Number): Int {
val result = (a as Int) compareTo <!DEBUG_INFO_SMARTCAST!>a<!>
checkSubtype<Int>(<!DEBUG_INFO_SMARTCAST!>a<!>)
@@ -10,4 +12,4 @@ fun bar(a: Number): Int {
val result = 42 compareTo (a as Int)
checkSubtype<Int>(<!DEBUG_INFO_SMARTCAST!>a<!>)
return result
}
}
@@ -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
@@ -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 <!INFIX_MODIFIER_REQUIRED!>plus<!> 1)
fooByte(1 <!INFIX_MODIFIER_REQUIRED!>plus<!> 1)
fooLong(1 <!INFIX_MODIFIER_REQUIRED!>plus<!> 1)
fooShort(1 <!INFIX_MODIFIER_REQUIRED!>plus<!> 1)
fooInt(1 times 1)
fooByte(1 times 1)
fooLong(1 times 1)
fooShort(1 times 1)
fooInt(1 <!INFIX_MODIFIER_REQUIRED!>times<!> 1)
fooByte(1 <!INFIX_MODIFIER_REQUIRED!>times<!> 1)
fooLong(1 <!INFIX_MODIFIER_REQUIRED!>times<!> 1)
fooShort(1 <!INFIX_MODIFIER_REQUIRED!>times<!> 1)
fooInt(1 div 1)
fooByte(1 div 1)
fooLong(1 div 1)
fooShort(1 div 1)
fooInt(1 <!INFIX_MODIFIER_REQUIRED!>div<!> 1)
fooByte(1 <!INFIX_MODIFIER_REQUIRED!>div<!> 1)
fooLong(1 <!INFIX_MODIFIER_REQUIRED!>div<!> 1)
fooShort(1 <!INFIX_MODIFIER_REQUIRED!>div<!> 1)
fooInt(1 mod 1)
fooByte(1 mod 1)
fooLong(1 mod 1)
fooShort(1 mod 1)
fooInt(1 <!INFIX_MODIFIER_REQUIRED!>mod<!> 1)
fooByte(1 <!INFIX_MODIFIER_REQUIRED!>mod<!> 1)
fooLong(1 <!INFIX_MODIFIER_REQUIRED!>mod<!> 1)
fooShort(1 <!INFIX_MODIFIER_REQUIRED!>mod<!> 1)
}
@@ -16,7 +16,7 @@ fun <T: Any, E> T.foo(<!UNUSED_PARAMETER!>x<!> : E, y : A) : T {
class A
operator fun A.plus(<!UNUSED_PARAMETER!>a<!> : Any) {
infix operator fun A.plus(<!UNUSED_PARAMETER!>a<!> : Any) {
1.foo()
true.<!TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>foo<!>(<!NO_VALUE_FOR_PARAMETER, NO_VALUE_FOR_PARAMETER!>)<!>
@@ -25,7 +25,7 @@ package outer {
public fun kotlin.Int.foo(): kotlin.Int
public operator fun </*0*/ T> 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 {
@@ -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<String>) {
@@ -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
}
@@ -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 <!TYPE_MISMATCH!>{ } <!TOO_MANY_ARGUMENTS!>{ }<!><!>
@@ -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
@@ -13,5 +13,5 @@ fun test() {
// from library
class Pair<out A, out B>
fun <K, V> mapOf(keyValuePair: Pair<K, V>): Map<K, V> = throw Exception()
fun <A, B> A.to(that: B): Pair<A, B> = throw Exception()
infix fun <A, B> A.to(that: B): Pair<A, B> = throw Exception()
@@ -4,7 +4,7 @@ public fun </*0*/ T> bar(/*0*/ t: T, /*1*/ ext: GenericClass<T>.() -> kotlin.Uni
public fun </*0*/ K, /*1*/ V> mapOf(/*0*/ keyValuePair: Pair<K, V>): kotlin.Map<K, V>
public fun test(): kotlin.Unit
public fun </*0*/ K, /*1*/ V> GenericClass<kotlin.Map<K, V>>.foo(): kotlin.Unit
public fun </*0*/ A, /*1*/ B> A.to(/*0*/ that: B): Pair<A, B>
public infix fun </*0*/ A, /*1*/ B> A.to(/*0*/ that: B): Pair<A, B>
public final class GenericClass</*0*/ out T> {
public constructor GenericClass</*0*/ out T>()
@@ -25,10 +25,10 @@ fun foo() {
// ---------------------
// copy from kotlin util
// copy from kotlin util (but with `infix` modifier on `map`)
fun <T> array(vararg t : T) : Array<T> = t as Array<T>
fun <T, R> Array<T>.map(<!UNUSED_PARAMETER!>transform<!> : (T) -> R) : List<R> {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
infix fun <T, R> Array<T>.map(<!UNUSED_PARAMETER!>transform<!> : (T) -> R) : List<R> {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
fun <T, R> Iterable<T>.map(<!UNUSED_PARAMETER!>transform<!> : (T) -> R) : List<R> {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
infix fun <T, R> Iterable<T>.map(<!UNUSED_PARAMETER!>transform<!> : (T) -> R) : List<R> {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
@@ -3,6 +3,6 @@ package
package a {
public fun </*0*/ T> array(/*0*/ vararg t: T /*kotlin.Array<out T>*/): kotlin.Array<T>
public fun foo(): kotlin.Unit
public fun </*0*/ T, /*1*/ R> kotlin.Array<T>.map(/*0*/ transform: (T) -> R): kotlin.List<R>
public fun </*0*/ T, /*1*/ R> kotlin.Iterable<T>.map(/*0*/ transform: (T) -> R): kotlin.List<R>
public infix fun </*0*/ T, /*1*/ R> kotlin.Array<T>.map(/*0*/ transform: (T) -> R): kotlin.List<R>
public infix fun </*0*/ T, /*1*/ R> kotlin.Iterable<T>.map(/*0*/ transform: (T) -> R): kotlin.List<R>
}
@@ -10,7 +10,7 @@ fun <T> id(t: T): T = t
//binary expressions
//identifier
fun <T> Z.foo(a: A<T>): A<T> = a
infix fun <T> Z.foo(a: A<T>): A<T> = a
fun test(z: Z) {
z <!TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>foo<!> <!TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>newA<!>()
@@ -13,7 +13,7 @@ package h {
public fun use(/*0*/ vararg a: kotlin.Any? /*kotlin.Array<out kotlin.Any?>*/): kotlin.Array<out kotlin.Any?>
public operator fun </*0*/ T> h.Z.compareTo(/*0*/ a: h.A<T>): kotlin.Int
public fun h.Z.equals(/*0*/ any: kotlin.Any): kotlin.Int
public fun </*0*/ T> h.Z.foo(/*0*/ a: h.A<T>): h.A<T>
public infix fun </*0*/ T> h.Z.foo(/*0*/ a: h.A<T>): h.A<T>
public operator fun </*0*/ T> h.Z.plus(/*0*/ a: h.A<T>): h.A<T>
public interface A</*0*/ T> {
@@ -2,7 +2,7 @@
package aaa
fun <T> T.foo(t: T) = t
infix fun <T> T.foo(t: T) = t
fun <T> id(t: T) = t
@@ -3,5 +3,5 @@ package
package aaa {
public fun a(): kotlin.Unit
public fun </*0*/ T> id(/*0*/ t: T): T
public fun </*0*/ T> T.foo(/*0*/ t: T): T
public infix fun </*0*/ T> T.foo(/*0*/ t: T): T
}
@@ -10,7 +10,7 @@ public fun <T> query(<!UNUSED_PARAMETER!>t<!>: T, <!UNUSED_PARAMETER!>args<!>: M
fun test(pair: Pair<String, Int>) {
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<String, Int>) {
//from standard library
fun <K, V> mapOf(vararg <!UNUSED_PARAMETER!>values<!>: Pair<K, V>): Map<K, V> { throw Exception() }
fun <A,B> A.to(<!UNUSED_PARAMETER!>that<!>: B): Pair<A, B> { throw Exception() }
infix fun <A,B> A.to(<!UNUSED_PARAMETER!>that<!>: B): Pair<A, B> { throw Exception() }
fun println(<!UNUSED_PARAMETER!>message<!> : Any?) { throw Exception() }
@@ -7,7 +7,7 @@ package b {
public fun </*0*/ T> query(/*0*/ t: T, /*1*/ args: kotlin.Map<kotlin.String, kotlin.Any>): kotlin.List<T>
public fun test(/*0*/ pair: b.Pair<kotlin.String, kotlin.Int>): kotlin.Unit
public fun test(/*0*/ t: kotlin.String): kotlin.Unit
public fun </*0*/ A, /*1*/ B> A.to(/*0*/ that: B): b.Pair<A, B>
public infix fun </*0*/ A, /*1*/ B> A.to(/*0*/ that: B): b.Pair<A, B>
public final class Pair</*0*/ out A, /*1*/ out B> {
public constructor Pair</*0*/ out A, /*1*/ out B>()
@@ -6,7 +6,7 @@ package i
public fun<T> from(<!UNUSED_PARAMETER!>yielder<!>: ()->Iterable<T>) : Iterable<T> {
<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
public fun<T> Iterable<T>.where(<!UNUSED_PARAMETER!>predicate<!> : (T)->Boolean) : ()->Iterable<T> {
public infix fun<T> Iterable<T>.where(<!UNUSED_PARAMETER!>predicate<!> : (T)->Boolean) : ()->Iterable<T> {
<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
fun a() {
@@ -3,5 +3,5 @@ package
package i {
public fun a(): kotlin.Unit
public fun </*0*/ T> from(/*0*/ yielder: () -> kotlin.Iterable<T>): kotlin.Iterable<T>
public fun </*0*/ T> kotlin.Iterable<T>.where(/*0*/ predicate: (T) -> kotlin.Boolean): () -> kotlin.Iterable<T>
public infix fun </*0*/ T> kotlin.Iterable<T>.where(/*0*/ predicate: (T) -> kotlin.Boolean): () -> kotlin.Iterable<T>
}
@@ -5,7 +5,7 @@ package i
import java.util.ArrayList
public fun<TItem> Iterable<TItem>.where(<!UNUSED_PARAMETER!>predicate<!> : (TItem)->Boolean) : ()->Iterable<TItem> {
public infix fun<TItem> Iterable<TItem>.where(<!UNUSED_PARAMETER!>predicate<!> : (TItem)->Boolean) : ()->Iterable<TItem> {
<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
public fun<TItem, TResult> select(<!UNUSED_PARAMETER!>yielder<!>: ()->Iterable<TItem>, <!UNUSED_PARAMETER!>selector<!> : (TItem)->TResult) : ()->Iterable<TResult> {
@@ -3,5 +3,5 @@ package
package i {
public fun a(): kotlin.Unit
public fun </*0*/ TItem, /*1*/ TResult> select(/*0*/ yielder: () -> kotlin.Iterable<TItem>, /*1*/ selector: (TItem) -> TResult): () -> kotlin.Iterable<TResult>
public fun </*0*/ TItem> kotlin.Iterable<TItem>.where(/*0*/ predicate: (TItem) -> kotlin.Boolean): () -> kotlin.Iterable<TItem>
public infix fun </*0*/ TItem> kotlin.Iterable<TItem>.where(/*0*/ predicate: (TItem) -> kotlin.Boolean): () -> kotlin.Iterable<TItem>
}
+4 -4
View File
@@ -1,8 +1,8 @@
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -NOTHING_TO_INLINE -NON_LOCAL_RETURN_NOT_ALLOWED
fun Function1<Int, Unit>.noInlineExt(p: Int) {}
infix fun Function1<Int, Unit>.noInlineExt(p: Int) {}
inline fun Function1<Int, Unit>.inlineExt2(p: Int) {
inline infix fun Function1<Int, Unit>.inlineExt2(p: Int) {
{
<!USAGE_IS_NOT_INLINABLE!>noInlineExt<!>(11)
<!USAGE_IS_NOT_INLINABLE!>this<!>.noInlineExt(11)
@@ -25,7 +25,7 @@ inline fun inlineFunWithInvoke(s: (p: Int) -> Unit) {
{
s(11)
s.invoke(11)
s invoke 11
s <!INFIX_MODIFIER_REQUIRED!>invoke<!> 11
}()
}
@@ -33,7 +33,7 @@ inline fun inlineFunWithInvokeNonInline(noinline s: (p: Int) -> Unit) {
{
s(11)
s.invoke(11)
s invoke 11
s <!INFIX_MODIFIER_REQUIRED!>invoke<!> 11
}()
}
+2 -2
View File
@@ -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
@@ -1,8 +1,8 @@
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -NOTHING_TO_INLINE
fun Function1<Int, Unit>.noInlineExt(p: Int) {}
infix fun Function1<Int, Unit>.noInlineExt(p: Int) {}
inline fun Function1<Int, Unit>.inlineExt2(p: Int) {
inline infix fun Function1<Int, Unit>.inlineExt2(p: Int) {
<!USAGE_IS_NOT_INLINABLE!>noInlineExt<!>(11)
<!USAGE_IS_NOT_INLINABLE!>this<!>.noInlineExt(11)
<!USAGE_IS_NOT_INLINABLE!>this<!> noInlineExt 11
@@ -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
+6 -6
View File
@@ -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 <!INFIX_MODIFIER_REQUIRED!>invoke<!> 11
11.ext(11)
11 ext 11
11 <!INFIX_MODIFIER_REQUIRED!>ext<!> 11
}
inline fun inlineFunWithInvokeNonInline(noinline s: (p: Int) -> Unit, ext: Int.(p: Int) -> Unit) {
s(11)
s.invoke(11)
s invoke 11
s <!INFIX_MODIFIER_REQUIRED!>invoke<!> 11
11.ext(11)
11 ext 11
11 <!INFIX_MODIFIER_REQUIRED!>ext<!> 11
}
inline fun Function1<Int, Unit>.inlineExt() {
invoke(11)
this.invoke(11)
this invoke 11
this <!INFIX_MODIFIER_REQUIRED!>invoke<!> 11
this(11)
}
}
@@ -1,7 +1,7 @@
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -NOTHING_TO_INLINE
class Z {
inline fun <R> inlineFun(crossinline p: () -> R) {
inline infix fun <R> inlineFun(crossinline p: () -> R) {
p()
}
}
@@ -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 </*0*/ R> inlineFun(/*0*/ @kotlin.crossinline() p: () -> R): kotlin.Unit
@kotlin.inline() public final infix fun </*0*/ R> inlineFun(/*0*/ @kotlin.crossinline() p: () -> R): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@@ -3,13 +3,13 @@
inline fun inlineFunWithInvoke(s: (p: Int) -> Unit) {
(s)(11)
(s).invoke(11)
(s) invoke 11
(s) <!INFIX_MODIFIER_REQUIRED!>invoke<!> 11
(<!USAGE_IS_NOT_INLINABLE, UNUSED_EXPRESSION!>s<!>)
}
inline fun Function1<Int, Unit>.inlineExt() {
(this).invoke(11)
(this) invoke 11
(this) <!INFIX_MODIFIER_REQUIRED!>invoke<!> 11
(this)(11)
(<!USAGE_IS_NOT_INLINABLE, UNUSED_EXPRESSION!>this<!>)
}
@@ -17,7 +17,7 @@ inline fun Function1<Int, Unit>.inlineExt() {
inline fun inlineFunWithInvoke2(s: (p: Int) -> Unit) {
(((s)))(11)
(((s))).invoke(11)
(((s))) invoke 11
(((s))) <!INFIX_MODIFIER_REQUIRED!>invoke<!> 11
(((<!USAGE_IS_NOT_INLINABLE, UNUSED_EXPRESSION!>s<!>)))
}
+5 -5
View File
@@ -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 <!INFIX_MODIFIER_REQUIRED!>invoke<!> 11
11.ext(11)
11 ext 11
11 <!INFIX_MODIFIER_REQUIRED!>ext<!> 11
<!USAGE_IS_NOT_INLINABLE, UNUSED_EXPRESSION!>s<!>
<!USAGE_IS_NOT_INLINABLE, UNUSED_EXPRESSION!>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 <!INFIX_MODIFIER_REQUIRED!>invoke<!> 11
11.ext(11)
11 ext 11
11 <!INFIX_MODIFIER_REQUIRED!>ext<!> 11
<!UNUSED_EXPRESSION!>s<!>
<!USAGE_IS_NOT_INLINABLE, UNUSED_EXPRESSION!>ext<!>
@@ -48,7 +48,7 @@ inline fun Function1<Int, Unit>.inlineExt() {
Test().test(){
invoke(11)
this.invoke(11)
this invoke 11
this <!INFIX_MODIFIER_REQUIRED!>invoke<!> 11
this(11)
<!USAGE_IS_NOT_INLINABLE, UNUSED_EXPRESSION!>this<!>
@@ -1,16 +1,15 @@
class A() {
operator fun plus(<!UNUSED_PARAMETER!>i<!> : Int) {}
operator infix fun plus(<!UNUSED_PARAMETER!>i<!> : Int) {}
operator fun minus() {}
operator fun contains(<!UNUSED_PARAMETER!>a<!> : Any?) : Boolean = true
operator infix fun contains(<!UNUSED_PARAMETER!>a<!> : Any?) : Boolean = true
}
operator fun A.div(<!UNUSED_PARAMETER!>i<!> : Int) {}
operator fun A?.times(<!UNUSED_PARAMETER!>i<!> : Int) {}
operator infix fun A.div(<!UNUSED_PARAMETER!>i<!> : Int) {}
operator infix fun A?.times(<!UNUSED_PARAMETER!>i<!> : Int) {}
fun test(x : Int?, a : A?) {
x<!UNSAFE_CALL!>.<!>plus(1)
x?.plus(1)
x <!UNSAFE_INFIX_CALL!>plus<!> 1
x <!UNSAFE_INFIX_CALL!>+<!> 1
<!UNSAFE_CALL!>-<!>x
x<!UNSAFE_CALL!>.<!>minus()
@@ -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
}
@@ -20,4 +20,4 @@ val x = B()["a", "v"]["a" to "b"] {} ["q" to "p"] // does not parses around {}
//from library
data class Pair<out A, out B> (val first: A, val second: B)
fun <A,B> A.to(that: B) = Pair(this, that)
infix fun <A,B> A.to(that: B) = Pair(this, that)
@@ -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 </*0*/ A, /*1*/ B> A.to(/*0*/ that: B): Pair<A, B>
public infix fun </*0*/ A, /*1*/ B> A.to(/*0*/ that: B): Pair<A, B>
public final class A {
public constructor A()
@@ -40,16 +40,15 @@ fun test() {
platformN <!UNSAFE_INFIX_CALL!>+<!> 1
platformJ + 1
1 plus platformNN
1 <!INFIX_MODIFIER_REQUIRED!>plus<!> platformNN
1 <!NONE_APPLICABLE!>plus<!> platformN
1 plus platformJ
1 <!INFIX_MODIFIER_REQUIRED!>plus<!> platformJ
platformNN plus 1
platformN <!UNSAFE_INFIX_CALL!>plus<!> 1
platformJ plus 1
platformNN <!INFIX_MODIFIER_REQUIRED!>plus<!> 1
platformN <!UNSAFE_INFIX_CALL, INFIX_MODIFIER_REQUIRED!>plus<!> 1
platformJ <!INFIX_MODIFIER_REQUIRED!>plus<!> 1
platformNN += 1
platformN <!UNSAFE_INFIX_CALL!>+=<!> 1
platformJ += 1
}
}
@@ -4,9 +4,9 @@
import java.util.*
fun <T> Iterator<T>.foreach(operation: (element: T) -> Unit) : Unit { while(hasNext()) operation(next()) }
infix fun <T> Iterator<T>.foreach(operation: (element: T) -> Unit) : Unit { while(hasNext()) operation(next()) }
fun <T> Iterator<T>.foreach(operation: (index: Int, element: T) -> Unit) : Unit {
infix fun <T> Iterator<T>.foreach(operation: (index: Int, element: T) -> Unit) : Unit {
var k = 0
while(hasNext())
operation(k++, next())
@@ -8,5 +8,5 @@ public fun println(/*0*/ message: kotlin.Long): kotlin.Unit
@kotlin.inline() public fun </*0*/ T> run(/*0*/ body: () -> T): T
public fun </*0*/ T> kotlin.Iterable<T>.foreach(/*0*/ operation: (T) -> kotlin.Unit): kotlin.Unit
public fun </*0*/ T> kotlin.Iterable<T>.foreach(/*0*/ operation: (kotlin.Int, T) -> kotlin.Unit): kotlin.Unit
public fun </*0*/ T> kotlin.Iterator<T>.foreach(/*0*/ operation: (T) -> kotlin.Unit): kotlin.Unit
public fun </*0*/ T> kotlin.Iterator<T>.foreach(/*0*/ operation: (kotlin.Int, T) -> kotlin.Unit): kotlin.Unit
public infix fun </*0*/ T> kotlin.Iterator<T>.foreach(/*0*/ operation: (T) -> kotlin.Unit): kotlin.Unit
public infix fun </*0*/ T> kotlin.Iterator<T>.foreach(/*0*/ operation: (kotlin.Int, T) -> kotlin.Unit): kotlin.Unit
+1 -1
View File
@@ -20,7 +20,7 @@ fun <T> generic_invoker(gen : (String) -> T) : T {
return gen("")
}
fun <T> T.with(f : T.() -> Unit) {
infix fun <T> T.with(f : T.() -> Unit) {
f()
}
+1 -1
View File
@@ -7,4 +7,4 @@ public fun </*0*/ T> generic_invoker(/*0*/ gen: (kotlin.String) -> T): T
public fun main(/*0*/ args: kotlin.Array<kotlin.String>): kotlin.Unit
public fun testFunny(): kotlin.Unit
public fun testFunny2(): kotlin.Unit
public fun </*0*/ T> T.with(/*0*/ f: T.() -> kotlin.Unit): kotlin.Unit
public infix fun </*0*/ T> T.with(/*0*/ f: T.() -> kotlin.Unit): kotlin.Unit
@@ -1,7 +1,7 @@
package o
class A {
fun foo(b: B) = b
infix fun foo(b: B) = b
}
class B {
@@ -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
}
@@ -10,4 +10,4 @@ class Test {
}
class Pair<out A, out B>(val first: A, val second: B)
fun <A, B> A.to(that: B) = Pair(this, that)
infix fun <A, B> A.to(that: B) = Pair(this, that)
@@ -1,6 +1,6 @@
package
public fun </*0*/ A, /*1*/ B> A.to(/*0*/ that: B): Pair<A, B>
public infix fun </*0*/ A, /*1*/ B> A.to(/*0*/ that: B): Pair<A, B>
public interface A {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
+1 -1
View File
@@ -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) {
+1 -1
View File
@@ -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)
+1 -1
View File
@@ -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(<!UNUSED_PARAMETER!>pair<!>: StringPair): MutableMap<String, String> {
<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
+1 -1
View File
@@ -2,7 +2,7 @@ package
public fun F(): kotlin.MutableMap<kotlin.String, kotlin.String>
public fun hashMapOf(/*0*/ pair: StringPair): kotlin.MutableMap<kotlin.String, kotlin.String>
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)
@@ -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()
@@ -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()
@@ -68,7 +68,7 @@ public abstract class BaseDiagnosticsTest extends
"\nfun <T> checkSubtype(t: T) = t" +
"\nclass Inv<T>" +
"\nfun <E> Inv<E>._() {}" +
"\nfun <T> T.checkType(f: Inv<T>.() -> Unit) {}";
"\ninfix fun <T> T.checkType(f: Inv<T>.() -> Unit) {}";
public static final String CHECK_TYPE_IMPORT = "import " + CHECK_TYPE_PACKAGE + ".*";
public static final String EXPLICIT_FLEXIBLE_TYPES_DIRECTIVE = "EXPLICIT_FLEXIBLE_TYPES";
+1 -1
View File
@@ -6,7 +6,7 @@ fun f(): Unit {
var x: Int? = <warning>1</warning>
x = 1
x + 1
x plus 1
x.plus(1)
x < 1
x += 1
+2 -2
View File
@@ -13,7 +13,7 @@ fun <T: Any, E> T.foo(<warning>x</warning> : E, y : A) : T {
class A
operator fun A.plus(<warning>a</warning> : Any) {
infix operator fun A.plus(<warning>a</warning> : Any) {
1.foo()
true.<error>foo</error>(<error><error>)</error></error>
@@ -21,7 +21,7 @@ operator fun A.plus(<warning>a</warning> : Any) {
<warning>1</warning>
}
operator fun A.plus(<warning>a</warning> : Int) {
infix operator fun A.plus(<warning>a</warning> : Int) {
<warning>1</warning>
}
+1 -1
View File
@@ -7,5 +7,5 @@ fun foo() {
//extract from library
fun <K, V> hashMap(<warning>p</warning>: Pair<K, V>): MutableMap<K, V> {<error>}</error>
fun <K, V> K.to(<warning>v</warning>: V): Pair<K, V> {<error>}</error>
infix fun <K, V> K.to(<warning>v</warning>: V): Pair<K, V> {<error>}</error>
class Pair<K, V> {}