KT-5488 Invalid ambiguity between plus and plusAssign

#KT-5488  Fixed
This commit is contained in:
Andrey Breslav
2015-02-27 16:23:34 +03:00
parent 9c2a9e0bdb
commit 4c84b19b33
11 changed files with 170 additions and 18 deletions
@@ -8,7 +8,7 @@ class MyInt(val i: Int) {
fun Any.plusAssign(<!UNUSED_PARAMETER!>a<!>: Any) {}
fun test(m: MyInt) {
m <!ASSIGN_OPERATOR_AMBIGUITY!>+=<!> m
m += m
var i = 1
i <!ASSIGN_OPERATOR_AMBIGUITY!>+=<!> 34
@@ -0,0 +1,20 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
class C {
fun get(i: Int): C = this
}
fun C.plus(a: Any): C = this
fun C.plusAssign(a: Any) {}
class C1 {
fun get(i: Int): C = C()
fun set(i: Int, v: C) {}
}
fun test() {
val c = C()
c[0] += ""
var c1 = C1()
c1[0] <!ASSIGN_OPERATOR_AMBIGUITY!>+=<!> ""
}
@@ -0,0 +1,22 @@
package
internal fun test(): kotlin.Unit
internal fun C.plus(/*0*/ a: kotlin.Any): C
internal fun C.plusAssign(/*0*/ a: kotlin.Any): kotlin.Unit
internal final class C {
public constructor C()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
internal final fun get(/*0*/ i: kotlin.Int): C
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
internal final class C1 {
public constructor C1()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
internal final fun get(/*0*/ i: kotlin.Int): C
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
internal final fun set(/*0*/ i: kotlin.Int, /*1*/ v: C): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@@ -0,0 +1,13 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
class C
fun C.plus(a: Any): C = this
fun C.plusAssign(a: Any) {}
fun test() {
val c = C()
c += ""
var c1 = C()
c1 <!ASSIGN_OPERATOR_AMBIGUITY!>+=<!> ""
}
@@ -0,0 +1,12 @@
package
internal fun test(): kotlin.Unit
internal fun C.plus(/*0*/ a: kotlin.Any): C
internal fun C.plusAssign(/*0*/ a: kotlin.Any): kotlin.Unit
internal final class C {
public constructor C()
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,19 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
class C {
val c: C = C()
}
fun C.plus(a: Any): C = this
fun C.plusAssign(a: Any) {}
class C1 {
var c: C = C()
}
fun test() {
val c = C()
c.c += ""
var c1 = C1()
c1.c <!ASSIGN_OPERATOR_AMBIGUITY!>+=<!> ""
}
@@ -0,0 +1,21 @@
package
internal fun test(): kotlin.Unit
internal fun C.plus(/*0*/ a: kotlin.Any): C
internal fun C.plusAssign(/*0*/ a: kotlin.Any): kotlin.Unit
internal final class C {
public constructor C()
internal final val c: C
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
}
internal final class C1 {
public constructor C1()
internal final var c: C
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
}