hughperman / pure-lang

Automatically exported from code.google.com/p/pure-lang
0 stars 0 forks source link

pattern matching against {...} crashes #76

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
> foo x = case x of {} = zero; y@{_} = one,y; y@{_,_} = two,y; y@{_,_,_} = 
three,y; y@_ = other,y; end;
> bar x = case x of y@{_,_,_} = three,y; y@{_,_} = two,y; y@{_} = one,y; {} = 
zero; y@_ = other,y; end;
> foo {};
Assertion failed: (!xs.empty()), function complex_match, file interpreter.cc, 
line 16225.
Abort trap: 6 (core dumped)

Similarly for foo {1}, bar {}, and bar {1}.

What is the expected output?
Desire these pattern matches to work. Minimally, expect interpreter not to 
crash.

What version of the product are you using? On what operating system?
Pure 0.5.3 on FreeBSD

Original issue reported on code.google.com by dubious...@gmail.com on 14 Jun 2012 at 3:42

GoogleCodeExporter commented 8 years ago
The crashes seem to be trigger by the {} pattern.

Original comment by dubious...@gmail.com on 14 Jun 2012 at 3:49

GoogleCodeExporter commented 8 years ago
Confirmed in Pure 0.55. The assertion is in the compiler, where code is 
generated from the pattern matching automaton. Here's a minimal example which 
trips it:

foo x = case x of
  {} = zero;
  {_} = one;
end;
foo;

Original comment by aggraef@gmail.com on 15 Jun 2012 at 1:37

GoogleCodeExporter commented 8 years ago
This issue was closed by revision c7bc2aeaaf6d.

Original comment by aggraef@gmail.com on 15 Jun 2012 at 2:03

GoogleCodeExporter commented 8 years ago
Thanks

Original comment by dubious...@gmail.com on 15 Jun 2012 at 9:50