mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-15 17:33:38 +00:00
Estimated hours taken: 1
Branches: main
Fix a bug that caused an abort of the MLDS code generator when it was given a
switch on a value of a foreign enum.
compiler/ml_switch_gen.m:
The bug was caused by the fact that the code that handles switches
handled only two kinds of tags (ints and strings), and did not list
the kinds of tags it did NOT handle. Change that to handle foreign
tags, and switch to using a switch instead of an if-then-else chain
to prevent the problem from recurring in the future.
compiler/options.m:
Add an option to allow the configure script to recognize the presence
of the fix, since we can't add code to the compiler that switches on
foreign enums unless the fix is installed.
tests/hard_coded/foreign_enum_switch.{m,exp}:
A new test case to test the fix.
tests/hard_coded/Mmakefile:
Enable the new test case.
4 lines
9 B
Plaintext
4 lines
9 B
Plaintext
42
|
|
43
|
|
44
|