asoffer / Icarus

An experimental general-purpose programming language
Apache License 2.0
9 stars 2 forks source link

Assigning the result of a comparison is broken #90

Closed perimosocordiae closed 2 years ago

perimosocordiae commented 2 years ago
foo: [4; bool]
x := 3
foo[2] = (x == 3)

Error message:

[140493260289864 ./ast/node.xmacro.h:14 Visit] Unreachable code-path.
(ComparisonOperator, N8compiler17EmitMoveAssignTagE)
*** SIGABRT received at time=1638552642 on cpu 0 ***
PC: @     0x7fc722e96808  (unknown)  pthread_kill
    @          0x1933800         64  absl::WriteFailureInfo()
    @          0x19334e4        224  absl::AbslFailureSignalHandler()
    @     0x7fc722e42520  (unknown)  (unknown)
Aborted (core dumped)

The simple workaround is to use an if scope to assign a literal true or false.