[Assign plugin] Add a compiler plugin for overloading assign ('=') operator

This commit is contained in:
Anže Sodja
2022-09-01 07:51:38 +02:00
committed by Dmitriy Novozhilov
parent 6052962f50
commit 09d6dfc8bf
62 changed files with 2822 additions and 6 deletions
@@ -0,0 +1,17 @@
/plusAssignPrecedence.kt:96:19: error: unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
public operator fun String?.plus(other: Any?): String defined in kotlin
task.valInput += "K"
^
/plusAssignPrecedence.kt:97:19: error: unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
public operator fun String?.plus(other: Any?): String defined in kotlin
task.varInput += "K"
^
/plusAssignPrecedence.kt:99:5: error: val cannot be reassigned
task.valInputWithPlus += "K"
^
/plusAssignPrecedence.kt:101:40: error: assignment operators ambiguity:
public final operator fun plus(v: String): StringPropertyWithPlusAndPlusAssign defined in StringPropertyWithPlusAndPlusAssign
public final operator fun plusAssign(v: String): Unit defined in StringPropertyWithPlusAndPlusAssign
task.varInputWithPlusAndPlusAssign += "K"
^