From 048256944331ed646225e856fca56728a074f3a6 Mon Sep 17 00:00:00 2001 From: Gabriel Kerneis Date: Tue, 14 Jan 2014 18:17:18 +0100 Subject: Fix vector concat pattern matching The concatenation list was reversed. --- src/test/pattern.sail | 2 +- src/test/vectors.sail | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src/test') diff --git a/src/test/pattern.sail b/src/test/pattern.sail index 22f0bcc4..e8fc1705 100644 --- a/src/test/pattern.sail +++ b/src/test/pattern.sail @@ -14,7 +14,7 @@ function unit main _ = { case x -> { x := 99; x } }); - (* doesn't work - main returns 1 instead of 42 *) + (* doesn't work - main returns 1 instead of 99 *) n := 3; switch n { case 0 -> { 21 } diff --git a/src/test/vectors.sail b/src/test/vectors.sail index f51b5d93..f6e0c532 100644 --- a/src/test/vectors.sail +++ b/src/test/vectors.sail @@ -21,17 +21,17 @@ function unit main _ = { case _ -> match_success := i }; - (* XXX function clause match fail *) - (* parameter is wrapped in a 1-tuple upon call, but probably not - unwrapped for the pattern-matching *) decode(i); (* concatenation *) switch i { - (* XXX match fails *) case ([bitzero] : [bitzero, bitone] : [bitzero]) -> match_success := 1 - (* but this works *) - case ([bitzero] : [bitzero] : [bitone] : [bitzero]) -> match_success := 2 + case _ -> match_success := i + }; + switch i { + (* check order of concatenation *) + case ([bitzero] : [bitone] : [bitzero] : [bitzero]) -> match_success := 99 + case ([bitzero] : [bitzero] : [bitone] : [bitzero]) -> match_success := 1 case _ -> match_success := i }; -- cgit v1.2.3