diff --git a/packages/runtime/src/compare/eq.ts b/packages/runtime/src/compare/eq.ts index 8a8594821..4af778dbe 100644 --- a/packages/runtime/src/compare/eq.ts +++ b/packages/runtime/src/compare/eq.ts @@ -80,6 +80,8 @@ export function eq( return right.get() === left.get(); } else if (left instanceof Character) { return (parseInt(left.get(), 10) || 0) === right.get(); + } else if (left instanceof String) { + return (parseInt(left.get(), 10) || 0) === right.get(); } else if (left instanceof Float) { return right.get() === left.getRaw(); } else if (left instanceof Numc) { diff --git a/test/operators/eq.ts b/test/operators/eq.ts index c04885333..bcf7947b0 100644 --- a/test/operators/eq.ts +++ b/test/operators/eq.ts @@ -98,4 +98,17 @@ ASSERT 1 = lv_val.`; } }); + it("integer = string = integer", async () => { + const code = ` +DATA num TYPE i. +DATA txt TYPE string. +num = 123. +txt = num. +ASSERT num = txt. +ASSERT txt = num.`; + const js = await run(code); + const f = new AsyncFunction("abap", js); + await f(abap); + }); + }); \ No newline at end of file