Files
mercury/tests/valid/det_string_switch.m
Peter Wang a6e28abc32 Fix a compiler abort when generating code for determistic string
Estimated hours taken: 1
Branches: main

compiler/ml_string_switch.m:
	Fix a compiler abort when generating code for determistic string
	switches.

tests/valid/Mmakefile:
tests/valid/det_string_switch.m:
	Add test case.
2007-09-14 00:57:06 +00:00

35 lines
720 B
Mathematica

% This is a regression test for a bug in MLDS code generation where it would
% abort while generating the code of a deterministic string switch.
%
% Uncaught Mercury exception:
% Software Error: ml_code_util.m: Unexpected: ml_gen_failure: `fail' has determinism `det'
:- module det_string_switch.
:- interface.
:- import_module io.
% Need this many cases to make a string switch.
:- inst bar
---> "a"
; "b"
; "c"
; "d"
; "e"
; "f"
; "g"
; "h".
:- pred foo(string::in(bar), io::di, io::uo) is det.
:- implementation.
foo("a", !IO).
foo("b", !IO).
foo("c", !IO).
foo("d", !IO).
foo("e", !IO).
foo("f", !IO).
foo("g", !IO).
foo("h", !IO).