Fix String?.plus extraction

This commit is contained in:
Tamas Vajk
2021-11-26 14:30:47 +01:00
committed by Ian Lynagh
parent ea4e919af5
commit 23c5caadc8
3 changed files with 2 additions and 5 deletions

View File

@@ -744,9 +744,7 @@ open class KotlinFileExtractor(
when {
c.origin == IrStatementOrigin.PLUS &&
(isNumericFunction("plus")
|| isFunction("kotlin", "String", "plus")
|| isFunction("kotlin", "String", "plus", true) // TODO: this is not correct. `a + b` becomes `(a?:"\"null\"") + (b?:"\"null\"")`.
) -> {
|| isFunction("kotlin", "String", "plus")) -> {
val id = tw.getFreshIdLabel<DbAddexpr>()
val type = useType(c.type)
tw.writeExprs_addexpr(id, type.javaResult.id, type.kotlinResult.id, parent, idx)

View File

@@ -75,5 +75,4 @@
| exprs.kt:138:12:138:20 | ... + ... | exprs.kt:138:12:138:14 | 123 | exprs.kt:138:18:138:20 | 456 |
| exprs.kt:164:8:164:16 | ... != ... | exprs.kt:164:8:164:8 | r | exprs.kt:164:13:164:16 | null |
| exprs.kt:193:31:193:37 | ... + ... | exprs.kt:193:31:193:32 | <get-a1>(...) | exprs.kt:193:36:193:37 | a2 |
| exprs.kt:207:19:207:23 | ... + ... | file://:0:0:0:0 | <none> | exprs.kt:207:23:207:23 | 5 |
| exprs.kt:209:19:209:25 | ... + ... | exprs.kt:209:20:209:21 | ...!! | exprs.kt:209:25:209:25 | 5 |

View File

@@ -544,7 +544,7 @@
| exprs.kt:206:21:206:27 | plus(...) | exprs.kt:203:5:214:5 | x | MethodAccess |
| exprs.kt:206:26:206:26 | 5 | exprs.kt:203:5:214:5 | x | IntegerLiteral |
| exprs.kt:207:9:207:23 | b1 | exprs.kt:203:5:214:5 | x | LocalVariableDeclExpr |
| exprs.kt:207:19:207:23 | ... + ... | exprs.kt:203:5:214:5 | x | AddExpr |
| exprs.kt:207:19:207:23 | plus(...) | exprs.kt:203:5:214:5 | x | MethodAccess |
| exprs.kt:207:23:207:23 | 5 | exprs.kt:203:5:214:5 | x | IntegerLiteral |
| exprs.kt:208:9:208:29 | b2 | exprs.kt:203:5:214:5 | x | LocalVariableDeclExpr |
| exprs.kt:208:19:208:19 | s | exprs.kt:203:5:214:5 | x | VarAccess |