lhmouse/asteria

Bad assignment to references

Closed this issue · 1 comments

var obj = { };
ref x -> obj.meow;
x = x ?? 42;
assert obj.meow == 42;
! error: asteria runtime error: apply_const_opt: String subscript applied to non-object (parent `integer 42`, key `meow`)
[thrown from native code at 'asteria/src/runtime/reference_modifier.cpp:45']
[backtrace frames:
  #0 native code at '<unknown>:-1:-1': string(166) "apply_const_opt: String subscript applied to non-object (parent `integer 42`, key `meow`)\n[thrown from native code at \'asteria/src/runtime/reference_modifier.cpp:45\']"
  #1   frame at '<stdin>:4:16': string(0) ""
  #2   function at '<stdin>:0:0': string(12) "<file scope>"
  -- end of backtrace frames]

Fixed in 4d046a4.