Diagnostics on 'infix' (declaration&use site)

This commit is contained in:
Yan Zhulanow
2015-09-29 19:22:28 +03:00
parent fff434d377
commit 1238e93b9f
11 changed files with 240 additions and 5 deletions
+26
View File
@@ -0,0 +1,26 @@
class Pair<out A, out B>(val first: A, val second: B)
class Example {
infix fun to(other: Example) = Pair(this, other)
fun toNonInfix(other: Example) = Pair(this, other)
}
infix fun Example.toExt(other: Example) = Pair(this, other)
fun Example.toExtNonInfix(other: Example) = Pair(this, other)
fun Example.withLambda(f: () -> Unit) = Pair(this, f)
fun test() {
Example() to Example()
Example() <!INFIX_MODIFIER_REQUIRED!>toNonInfix<!> Example()
Example().toNonInfix(Example())
val a = Example()
val b = Example()
a toExt b
a <!INFIX_MODIFIER_REQUIRED!>toExtNonInfix<!> b
a.toExtNonInfix(b)
a <!INFIX_MODIFIER_REQUIRED!>withLambda<!> { }
}
+24
View File
@@ -0,0 +1,24 @@
package
public fun test(): kotlin.Unit
public infix fun Example.toExt(/*0*/ other: Example): Pair<Example, Example>
public fun Example.toExtNonInfix(/*0*/ other: Example): Pair<Example, Example>
public fun Example.withLambda(/*0*/ f: () -> kotlin.Unit): Pair<Example, () -> kotlin.Unit>
public final class Example {
public constructor Example()
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 infix fun to(/*0*/ other: Example): Pair<Example, Example>
public final fun toNonInfix(/*0*/ other: Example): Pair<Example, Example>
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final class Pair</*0*/ out A, /*1*/ out B> {
public constructor Pair</*0*/ out A, /*1*/ out B>(/*0*/ first: A, /*1*/ second: B)
public final val first: A
public final val second: B
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,21 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
class Pair<A, B>(val a: A, val b: B)
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
<!INAPPLICABLE_INFIX_MODIFIER!>infix<!> fun w1() {}
<!INAPPLICABLE_INFIX_MODIFIER!>infix<!> fun w2(s: String) {}
<!INAPPLICABLE_INFIX_MODIFIER!>infix<!> fun String.w3() {}
<!INAPPLICABLE_INFIX_MODIFIER!>infix<!> fun String.w4(a: Int, b: Int) {}
<!INAPPLICABLE_INFIX_MODIFIER!>infix<!> fun w5(a: Int, b: Int) {}
class Example {
infix fun c1(s: String) {}
infix fun c2(s: String, a: Int = 0) {}
<!INAPPLICABLE_INFIX_MODIFIER!>infix<!> fun cw1(s: String, a: Int) {}
<!INAPPLICABLE_INFIX_MODIFIER!>infix<!> fun sw2() {}
}
@@ -0,0 +1,30 @@
package
public infix fun w1(): kotlin.Unit
public infix fun w2(/*0*/ s: kotlin.String): kotlin.Unit
public infix fun w5(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int): kotlin.Unit
public infix fun kotlin.String.o1(/*0*/ o: kotlin.String): kotlin.String
public infix fun kotlin.String.o2(/*0*/ o: kotlin.String, /*1*/ o2: kotlin.String? = ...): kotlin.String
public infix fun </*0*/ A, /*1*/ B> A.to(/*0*/ that: B): Pair<A, B>
public infix fun kotlin.String.w3(): kotlin.Unit
public infix fun kotlin.String.w4(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int): kotlin.Unit
public final class Example {
public constructor Example()
public final infix fun c1(/*0*/ s: kotlin.String): kotlin.Unit
public final infix fun c2(/*0*/ s: kotlin.String, /*1*/ a: kotlin.Int = ...): kotlin.Unit
public final infix fun cw1(/*0*/ s: kotlin.String, /*1*/ a: kotlin.Int): kotlin.Unit
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 infix fun sw2(): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final class Pair</*0*/ A, /*1*/ B> {
public constructor Pair</*0*/ A, /*1*/ B>(/*0*/ a: A, /*1*/ b: B)
public final val a: A
public final val b: B
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
}