diprism / perpl

The PERPL Compiler
MIT License
10 stars 5 forks source link

Conflicting types for terminal MulProd (tests/good/syntax_terms.ppl) #126

Closed ccshan closed 1 year ago

ccshan commented 1 year ago

perplc tests/good/syntax_terms.ppl gives

perplc: Conflicting types for terminal MulProd[(),()]: [(),(),() -> ()] versus [(),(),((), ())]
CallStack (from HasCallStack):
  error, called at ./Compile/RuleM.hs:139:72 in main:Compile.RuleM

Also syntax_terms.ppl is one of several files in tests/good not listed in run_tests.sh. Some others also don't succeed...?

davidweichiang commented 1 year ago

I didn't include syntax_terms.ppl in run_tests.sh because if I recall correctly it's actually very slow.

But the error is not intentional...looks weird.

Which other files fail?

davidweichiang commented 1 year ago

While trying to isolate this bug, I found another one:

define x1 = ((), ());
define y = \a:() . a;
let z = (x1, y) in ()

which gives the error

perplc: Name collisions for edge labels: x1
CallStack (from HasCallStack):
  error, called at ./Compile/RuleM.hs:149:11 in main:Compile.RuleM
davidweichiang commented 1 year ago

Undoubtedly, both of these bugs are my fault!

davidweichiang commented 1 year ago

Here's the minimal version of syntax_terms.ppl that triggers the bug, now fixed:

define id_f = \x. x;

define x004: () = (id_f (\x.x)) ();
define x025 = ((), ());

let x = (
  x004, x025
) in ()
davidweichiang commented 1 year ago

Ah, the second bug is not my fault. I'll make a new issue.