Add parens on generated S patterns
This fixes an issue where generated S patterns would sometimes not be
parenthesized, leading to invalid patterns being generated. This
occurred even in tutorial code, like Parity.
commit72f7b58ac3d601d82c38fdfb7e2b6c78c6271e9d
authorDavid Raymond Christiansen <david@davidchristiansen.dk>
dateFri 11 Jul 2014, 13:52 (12 years ago)
parent5b723cb
src/Idris/CaseSplit.hs+1−1
@@ -276,7 +276,7 @@ replaceSplits l ups = updateRHSs 1 (map (rep (expandBraces l)) ups)
276276 -- this isn't supported in a pattern, so special case here
277277 nshow (PRef _ (UN z)) | z == txt "Z" = "Z"
278278 nshow (PApp _ (PRef _ (UN s)) [x]) | s == txt "S" =
279− "S " ++ addBrackets (nshow (getTm x))
279+ "(S " ++ addBrackets (nshow (getTm x)) ++ ")"
280280 nshow t = show t
281281
282282 -- if there's any {n} replace with {n=n}