Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixity resolution not performed inside tuple sections #434

Open
ndmitchell opened this issue Jun 13, 2019 · 0 comments
Open

Fixity resolution not performed inside tuple sections #434

ndmitchell opened this issue Jun 13, 2019 · 0 comments

Comments

@ndmitchell
Copy link
Contributor

The code for leafFix misses a case for TupleSection, see

leafFix :: Monad m => [Fixity] -> Exp SrcSpanInfo -> m (Exp SrcSpanInfo)
leafFix fixs e' = case e' of
InfixApp l e1 op e2 -> liftM2 (flip (InfixApp l) op) (leafFix fixs e1) (fix e2)
App l e1 e2 -> liftM2 (App l) (fix e1) (fix e2)
NegApp l e -> liftM (NegApp l) $ fix e
Lambda l pats e -> liftM2 (Lambda l) (mapM fix pats) $ fix e
Let l bs e ->
let extraFix x = applyFixities (fixs ++ getBindFixities bs) x
in liftM2 (Let l) (extraFix bs) $ extraFix e
If l e a b -> liftM3 (If l) (fix e) (fix a) (fix b)
MultiIf l alts -> liftM (MultiIf l) (mapM fix alts)
Case l e alts -> liftM2 (Case l) (fix e) $ mapM fix alts
Do l stmts -> liftM (Do l) $ mapM fix stmts
MDo l stmts -> liftM (MDo l) $ mapM fix stmts
Tuple l bx exps -> liftM (Tuple l bx) $ mapM fix exps
List l exps -> liftM (List l) $ mapM fix exps
Paren l e -> liftM (Paren l) $ fix e
LeftSection l e op -> liftM (flip (LeftSection l) op) (fix e)
RightSection l op e -> liftM (RightSection l op) $ fix e
RecConstr l n fups -> liftM (RecConstr l n) $ mapM fix fups
RecUpdate l e fups -> liftM2 (RecUpdate l) (fix e) $ mapM fix fups
EnumFrom l e -> liftM (EnumFrom l) $ fix e
EnumFromTo l e1 e2 -> liftM2 (EnumFromTo l) (fix e1) (fix e2)
EnumFromThen l e1 e2 -> liftM2 (EnumFromThen l) (fix e1) (fix e2)
EnumFromThenTo l e1 e2 e3 -> liftM3 (EnumFromThenTo l) (fix e1) (fix e2) (fix e3)
ListComp l e quals -> liftM2 (ListComp l) (fix e) $ mapM fix quals
ParComp l e qualss -> liftM2 (ParComp l) (fix e) $ mapM (mapM fix) qualss
ExpTypeSig l e t -> liftM (flip (ExpTypeSig l) t) (fix e)
BracketExp l b -> liftM (BracketExp l) $ fix b
SpliceExp l s -> liftM (SpliceExp l) $ fix s
XTag l n ats mexp cs -> liftM3 (XTag l n) (mapM fix ats) (mapM fix mexp) (mapM fix cs)
XETag l n ats mexp -> liftM2 (XETag l n) (mapM fix ats) (mapM fix mexp)
XExpTag l e -> liftM (XExpTag l) $ fix e
XChildTag l cs -> liftM (XChildTag l) $ mapM fix cs
Proc l p e -> liftM2 (Proc l) (fix p) (fix e)
LeftArrApp l e1 e2 -> liftM2 (LeftArrApp l) (fix e1) (fix e2)
RightArrApp l e1 e2 -> liftM2 (RightArrApp l) (fix e1) (fix e2)
LeftArrHighApp l e1 e2 -> liftM2 (LeftArrHighApp l) (fix e1) (fix e2)
RightArrHighApp l e1 e2 -> liftM2 (RightArrHighApp l) (fix e1) (fix e2)
CorePragma l s e -> liftM (CorePragma l s) (fix e)
SCCPragma l s e -> liftM (SCCPragma l s) (fix e)
GenPragma l s ab cd e -> liftM (GenPragma l s ab cd) (fix e)
LCase l alts -> liftM (LCase l) $ mapM fix alts
_ -> return e'
. As a result, fixity resolution is not performed inside tuple sections, which causes upstream issues such as ndmitchell/hlint#673 found by @cocreature

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant