Commit 9ee33a53 authored by Jan Rasmus Tikovsky 's avatar Jan Rasmus Tikovsky
Browse files

Fixed bug regarding generation of Abstract Curry for functions with non-linear patterns

parent 58131c1e
......@@ -561,8 +561,10 @@ genPattern pos env (LiteralPattern l) = case l of
String _ cs -> genPattern pos env $ ListPattern [] $ map (LiteralPattern . Char noRef) cs
_ -> (env, CPLit $ genLiteral l)
genPattern _ env (VariablePattern v)
= let (env', idx) = genVarIndex env v
in (env', CPVar (idx, idName v))
= case getVarIndex env v of
Just idx -> (env, CPVar (idx, idName v))
Nothing -> let (env', idx') = genVarIndex env v
in (env', CPVar (idx', idName v))
genPattern pos env (ConstructorPattern qident args)
= let (env', args') = mapAccumL (genPattern pos) env args
in (env', CPComb (genQName False env qident) args')
......
add x x = x + x
test x y = x + y
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment