By Pavel Talanov: KT-618 overloaded assignment operators should not allow for returning types other than Unit of Subtypes or the type where they are defined
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
namespace lol
|
||||
|
||||
class B() {
|
||||
fun plusAssign(other : B) : String {
|
||||
return "s"
|
||||
}
|
||||
fun minusAssign(other : B) : String {
|
||||
return "s"
|
||||
}
|
||||
fun modAssign(other : B) : String {
|
||||
return "s"
|
||||
}
|
||||
fun divAssign(other : B) : String {
|
||||
return "s"
|
||||
}
|
||||
fun timesAssign(other : B) : String {
|
||||
return "s"
|
||||
}
|
||||
}
|
||||
|
||||
fun main(args : Array<String>) {
|
||||
var c = B()
|
||||
<!TYPE_MISMATCH!>c += B()<!>
|
||||
<!TYPE_MISMATCH!>c *= B()<!>
|
||||
<!TYPE_MISMATCH!>c /= B()<!>
|
||||
<!TYPE_MISMATCH!>c -= B()<!>
|
||||
<!TYPE_MISMATCH!>c %= B()<!>
|
||||
}
|
||||
Reference in New Issue
Block a user