File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -157,9 +157,15 @@ nBinary (Ann s1 b) e1@(AnnE s2 _) e2@(AnnE s3 _) =
157157
158158nSelectLoc
159159 :: NExprLoc -> Ann SrcSpan (NAttrPath NExprLoc ) -> Maybe NExprLoc -> NExprLoc
160- nSelectLoc e1@ (AnnE s1 _) (Ann s2 ats) d = case d of
161- Nothing -> AnnE (s1 <> s2) $ NSelect e1 ats Nothing
162- Just e2@ (AnnE s3 _) -> AnnE (s1 <> s2 <> s3) $ NSelect e1 ats $ pure e2
160+ nSelectLoc e1@ (AnnE s1 _) (Ann s2 ats) =
161+ -- 2021-05-16: NOTE: This could been rewritten into function application of @(s3, pure e2)@
162+ -- if @SrcSpan@ was Monoid, which requires @SorcePos@ to be a Monoid, and upstream code prevents it.
163+ -- Question upstream: https://github.com/mrkkrp/megaparsec/issues/450
164+ maybe
165+ ( AnnE s1s2 $ NSelect e1 ats Nothing )
166+ (\ e2@ (AnnE s3 _) -> AnnE (s1s2 <> s3) $ NSelect e1 ats $ pure e2)
167+ where
168+ s1s2 = s1 <> s2
163169
164170nHasAttr :: NExprLoc -> Ann SrcSpan (NAttrPath NExprLoc ) -> NExprLoc
165171nHasAttr e1@ (AnnE s1 _) (Ann s2 ats) = AnnE (s1 <> s2) $ NHasAttr e1 ats
You can’t perform that action at this time.
0 commit comments