[Test] Operator ambiguity check with 'set'
When using `x[y] += z` the spec mandates attempting all possible combinations. ^KT-62138 Fixed
This commit is contained in:
committed by
Space Team
parent
5b7b159d64
commit
c2dfe415f3
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
// FIR_IDENTICAL
|
||||
// ISSUE: KT-62138
|
||||
class HashMap<K, V>(
|
||||
private val defaultValue: V
|
||||
) {
|
||||
operator fun get(key: K): V = defaultValue
|
||||
operator fun set(key: K, value: V) { }
|
||||
}
|
||||
|
||||
private class X
|
||||
|
||||
private operator fun X?.plus(p: Int) = X()
|
||||
private operator fun X?.plusAssign(p: Int) { }
|
||||
|
||||
class C {
|
||||
private val map = HashMap<String, X>(defaultValue = X())
|
||||
|
||||
fun f(): Any? {
|
||||
map[""] <!ASSIGN_OPERATOR_AMBIGUITY!>+=<!> 1
|
||||
return map[""]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user