Skip to content

Commit

Permalink
Decent error when bytecompiling setq of a constant
Browse files Browse the repository at this point in the history
Could be more sophisticated, but this at least prevents the hard
crash. Fixes #1613.
  • Loading branch information
Bike committed Aug 3, 2024
1 parent 01cf28c commit b4e79dc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/core/bytecode_compiler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2266,8 +2266,10 @@ static void compile_setq_1(Symbol_sp var, T_sp valf, Lexenv_sp env, const Contex
}
if (ctxt.receiving() == -1)
ctxt.assemble0(vm_pop);
} else
UNREACHABLE();
} else if (std::holds_alternative<ConstantVarInfoV>(info)) {
// FIXME: Better error (warning?)
SIMPLE_ERROR("Cannot modify constant {}", var->__repr__());
} else UNREACHABLE();
}

void compile_setq(List_sp pairs, Lexenv_sp env, const Context ctxt) {
Expand Down

0 comments on commit b4e79dc

Please sign in to comment.