[Git][ghc/ghc][wip/T18599] add AnnDot annotation to getField calc

Shayne Fletcher gitlab at gitlab.haskell.org
Sun Oct 11 23:01:13 UTC 2020



Shayne Fletcher pushed to branch wip/T18599 at Glasgow Haskell Compiler / GHC


Commits:
418578bc by Shayne Fletcher at 2020-10-11T19:01:00-04:00
add AnnDot annotation to getField calc

- - - - -


1 changed file:

- compiler/GHC/Parser.y


Changes:

=====================================
compiler/GHC/Parser.y
=====================================
@@ -2619,19 +2619,17 @@ fexp    :: { ECP }
         -- See Note [Whitespace-sensitive operator parsing] in Lexer.x
         | fexp TIGHT_INFIX_PROJ field
             {% do { ; $1 <- runPV (unECP $1)
-                  -- Suppose lhs is an application term e.g. 'f a' and
-                  -- rhs is '.b'. Usually we want the parse 'f
-                  -- (a.b)' rather than '(f a).b.'. However, if lhs is
-                  -- a projection 'r.a' (say) then we want the parse
-                  -- '(r.a).b'.
-                  ; return . ecpFromExp $ case $1 of
-                      L _ (HsApp _ f arg)
-                        | not $ isGetField f ->
-                           let l = (comb2 arg $3) in
-                           L  (getLoc f `combineSrcSpans` l)
-                             (HsApp noExtField f (mkGetField l arg $3))
-                      _ -> mkGetField (comb2 $1 $>) $1 $3
-            }}
+                    -- Suppose lhs is an application term e.g. 'f a'
+                    -- and rhs is '.b'. Usually we want the parse 'f
+                    -- (a.b)' rather than '(f a).b.'. However, if lhs
+                    -- is a projection 'r.a' (say) then we want the
+                    -- parse '(r.a).b'.
+                    ; fmap ecpFromExp $ ams (case $1 of
+                        L _ (HsApp _ f arg) | not $ isGetField f ->
+                             let l = comb2 arg $3 in
+                             L (getLoc f `combineSrcSpans` l)
+                               (HsApp noExtField f (mkGetField l arg $3))
+                        _ -> mkGetField (comb2 $1 $>) $1 $3) [mj AnnDot $2] }}
 
         | aexp                       { $1 }
 



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/418578bc584967ff964d059b1e66a9ca3c4284b3

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/418578bc584967ff964d059b1e66a9ca3c4284b3
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20201011/ad204e5f/attachment-0001.html>


More information about the ghc-commits mailing list