transpiler icon indicating copy to clipboard operation
transpiler copied to clipboard

shift in byte mode should produce runtime error for dynamic type

Open arcanist123 opened this issue 4 years ago • 3 comments

This should not be possible to transpile - the lv_temp type should not allow shift in byte mode Probably a runtime check would also be required - the field symbol of type any that is pointing to invalid type should produce a runtime error instead

  DATA lv_temp TYPE string.
  lv_temp = 'abc'.
  SHIFT lv_temp BY 1 PLACES LEFT in byte mode.
  WRITE lv_temp.

arcanist123 avatar May 23 '21 09:05 arcanist123

a few notes on syntax errors:

it is the responsibility of abaplint to ensure the syntax is correct, there is also a lot of work to be done here

the transpiler takes the AST, and assumes its correct ABAP syntax and does it best to transpile it

I've added the "abaplint" label to the issues which I guess should be fixed in abaplint

larshp avatar May 24 '21 05:05 larshp

Agreed. I opened a separate issue in abaplint repository. This code should fail with runtime error instead of executing without any issue

  DATA lv_temp TYPE string.
  lv_temp = 'abc'.
  FIELD-SYMBOLS <lv> TYPE any.
  ASSIGN lv_temp TO <lv>.
  SHIFT <lv> BY 1 PLACES LEFT IN BYTE MODE.
  WRITE lv_temp.

arcanist123 avatar May 27 '21 23:05 arcanist123

runtime error = OBJECTS_NOT_BYTELIKE

larshp avatar Apr 18 '22 15:04 larshp