Signature checks fixed for plus() and minus()

This commit is contained in:
Andrey Breslav
2015-12-08 18:57:38 +03:00
parent 421f84e05a
commit 3eeab68261
4 changed files with 19 additions and 13 deletions
@@ -1,15 +1,15 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
class Example {
operator fun plus(): String = ""
<!INAPPLICABLE_OPERATOR_MODIFIER!>operator<!> fun plus(): String = ""
operator fun unaryPlus(): Int = 0
}
class ExampleDeprecated {
operator fun plus(): String = ""
<!INAPPLICABLE_OPERATOR_MODIFIER!>operator<!> fun plus(): String = ""
}
operator fun String.plus(): String = this
<!INAPPLICABLE_OPERATOR_MODIFIER!>operator<!> fun String.plus(): String = this
operator fun String.unaryPlus(): Int = 0
fun test() {
@@ -22,8 +22,8 @@ fun requireInt(n: Int) {}
fun requireString(s: String) {}
class Example2 {
operator fun plus() = this
operator fun minus() = this
<!INAPPLICABLE_OPERATOR_MODIFIER!>operator<!> fun plus() = this
<!INAPPLICABLE_OPERATOR_MODIFIER!>operator<!> fun minus() = this
fun test() {
<!DEPRECATED_UNARY_PLUS_MINUS!>+this<!>
+6 -2
View File
@@ -5,6 +5,8 @@ interface Example {
operator fun div(o: Example): Example
<!INAPPLICABLE_OPERATOR_MODIFIER!>operator<!> fun plus(o: Example, s: String = ""): Example
<!INAPPLICABLE_OPERATOR_MODIFIER!>operator<!> fun minus(vararg o: Example): Example
<!INAPPLICABLE_OPERATOR_MODIFIER!>operator<!> fun plus(): Example
<!INAPPLICABLE_OPERATOR_MODIFIER!>operator<!> fun minus(): Example
operator fun unaryPlus(): Example
operator fun unaryMinus(): Example
@@ -94,10 +96,12 @@ interface Example3 {
operator fun Example.plus(<!UNUSED_PARAMETER!>o<!>: Example): Example {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
operator fun Example.plus(<!UNUSED_PARAMETER!>o<!>: Any): Example {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
operator fun Example.div(<!UNUSED_PARAMETER!>o<!>: Example): Example {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
<!INAPPLICABLE_OPERATOR_MODIFIER!>operator<!> fun Example.plus(<!UNUSED_PARAMETER!>o<!>: Example, <!UNUSED_PARAMETER!>s<!>: String = ""): Example {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
<!INAPPLICABLE_OPERATOR_MODIFIER!>operator<!> fun Example.minus(vararg <!UNUSED_PARAMETER!>o<!>: Example): Example {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
<!INAPPLICABLE_OPERATOR_MODIFIER!>operator<!> fun Example.plus(): Example {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
<!INAPPLICABLE_OPERATOR_MODIFIER!>operator<!> fun Example.minus(): Example {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
operator fun Example.unaryPlus(): Example {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
operator fun Example.unaryMinus(): Example {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
@@ -155,7 +159,7 @@ infix fun Example.i1(<!UNUSED_PARAMETER!>n<!>: Int) {}
<!INAPPLICABLE_OPERATOR_MODIFIER!>operator<!> fun plus(<!UNUSED_PARAMETER!>o<!>: Example): Example {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
<!INAPPLICABLE_OPERATOR_MODIFIER!>operator<!> fun plus(<!UNUSED_PARAMETER!>o<!>: String): Example {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
<!INAPPLICABLE_OPERATOR_MODIFIER!>operator<!> fun div(<!UNUSED_PARAMETER!>o<!>: Example): Example {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
<!INAPPLICABLE_OPERATOR_MODIFIER!>operator<!> fun plus(<!UNUSED_PARAMETER!>o<!>: Example, <!UNUSED_PARAMETER!>s<!>: String = ""): Example {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
<!INAPPLICABLE_OPERATOR_MODIFIER!>operator<!> fun minus(vararg <!UNUSED_PARAMETER!>o<!>: Example): Example {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
+6 -2
View File
@@ -27,8 +27,8 @@ public operator fun minusAssign(/*0*/ n: kotlin.Int): kotlin.String
public operator fun modAssign(/*0*/ vararg n: kotlin.Int /*kotlin.IntArray*/): kotlin.Unit
public operator fun next(): kotlin.String
public operator fun next(/*0*/ n: kotlin.Int): kotlin.String
public operator fun plus(/*0*/ o: Example): Example
public operator fun plus(/*0*/ o: Example, /*1*/ s: kotlin.String = ...): Example
public operator fun plus(/*0*/ o: kotlin.String): Example
public operator fun plusAssign(/*0*/ n: kotlin.Int): kotlin.Unit
public operator fun rangeTo(/*0*/ vararg o: kotlin.String /*kotlin.Array<out kotlin.String>*/): kotlin.Unit
public operator fun rangeTo(/*0*/ o: kotlin.Int): kotlin.Unit
@@ -62,13 +62,15 @@ public operator fun Example.inc(): Example
public operator fun Example.invoke(): kotlin.Unit
public operator fun Example.iterator(): kotlin.String
public operator fun Example.iterator(/*0*/ n: kotlin.Int): kotlin.String
public operator fun Example.minus(): Example
public operator fun Example.minus(/*0*/ vararg o: Example /*kotlin.Array<out Example>*/): Example
public operator fun Example.minusAssign(/*0*/ n: kotlin.Int): kotlin.String
public operator fun Example.modAssign(/*0*/ vararg n: kotlin.Int /*kotlin.IntArray*/): kotlin.Unit
public operator fun Example.next(): kotlin.String
public operator fun Example.next(/*0*/ n: kotlin.Int): kotlin.String
public operator fun Example.plus(/*0*/ o: Example): Example
public operator fun Example.plus(): Example
public operator fun Example.plus(/*0*/ o: Example, /*1*/ s: kotlin.String = ...): Example
public operator fun Example.plus(/*0*/ o: kotlin.Any): Example
public operator fun Example.plusAssign(/*0*/ n: kotlin.Int): kotlin.Unit
public operator fun Example.rangeTo(/*0*/ vararg o: kotlin.String /*kotlin.Array<out kotlin.String>*/): kotlin.Unit
public operator fun Example.rangeTo(/*0*/ o: kotlin.Int): kotlin.Unit
@@ -119,11 +121,13 @@ public interface Example {
public abstract operator fun invoke(): kotlin.Unit
public abstract operator fun iterator(): kotlin.String
public abstract operator fun iterator(/*0*/ n: kotlin.Int): kotlin.String
public abstract operator fun minus(): Example
public abstract operator fun minus(/*0*/ vararg o: Example /*kotlin.Array<out Example>*/): Example
public abstract operator fun minusAssign(/*0*/ n: kotlin.Int): kotlin.String
public abstract operator fun modAssign(/*0*/ vararg n: kotlin.Int /*kotlin.IntArray*/): kotlin.Unit
public abstract operator fun next(): kotlin.String
public abstract operator fun next(/*0*/ n: kotlin.Int): kotlin.String
public abstract operator fun plus(): Example
public abstract operator fun plus(/*0*/ o: Example): Example
public abstract operator fun plus(/*0*/ o: Example, /*1*/ s: kotlin.String = ...): Example
public abstract operator fun plusAssign(/*0*/ n: kotlin.Int): kotlin.Unit