FIR: Fix resolving += to ignore + if it doesn't return correct type
This is the FIR fix of the FE change tracked by https://youtrack.jetbrains.com/issue/KT-45503 Consider the following code: ``` fun foo() { var l = mutableListOf("") l += "" } ``` The above code used to be considered invalid due to ambiguous `+=`. But after KT-45503, it's now considered valid code because `plus` is not really a valid option for this code. This is because the return type of `plus` for `List` is `List`, which does not match the type of variable `l`. As for now, FIR rejects the above code due to ambiguous `+=`. This change fixes that by also consider the return type when resolving `+=`.
This commit is contained in:
committed by
TeamCityServer
parent
c43faa2ada
commit
4d2e3a2379
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun test1() {
|
||||
|
||||
Reference in New Issue
Block a user