diff options
author | Vladislav Zavialov <vlad.z.4096@gmail.com> | 2022-05-15 14:27:36 +0300 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-06-20 17:34:44 -0400 |
commit | d24afd9d7139d7a62f3b465af1be50b25c15e5b5 (patch) | |
tree | 914187fdbd3161c1734765b7f81a0172faff3779 /compiler/GHC/Iface/Ext | |
parent | b5590fff75496356b1817adc9de1f2d361a70dc5 (diff) | |
download | haskell-d24afd9d7139d7a62f3b465af1be50b25c15e5b5.tar.gz |
HsToken for @-patterns and TypeApplications (#19623)
One more step towards the new design of EPA.
Diffstat (limited to 'compiler/GHC/Iface/Ext')
-rw-r--r-- | compiler/GHC/Iface/Ext/Ast.hs | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/compiler/GHC/Iface/Ext/Ast.hs b/compiler/GHC/Iface/Ext/Ast.hs index e92327f6d7..9547296fe0 100644 --- a/compiler/GHC/Iface/Ext/Ast.hs +++ b/compiler/GHC/Iface/Ext/Ast.hs @@ -496,15 +496,15 @@ patScopes rsp useScope patScope xs = map (\(RS sc a) -> PS rsp useScope sc a) $ listScopes patScope xs --- | 'listScopes' specialised to 'HsPatSigType' -tScopes +-- | 'listScopes' specialised to 'HsConPatTyArg' +taScopes :: Scope -> Scope - -> [HsPatSigType (GhcPass a)] + -> [HsConPatTyArg (GhcPass a)] -> [TScoped (HsPatSigType (GhcPass a))] -tScopes scope rhsScope xs = +taScopes scope rhsScope xs = map (\(RS sc a) -> TS (ResolvedScopes [scope, sc]) (unLoc a)) $ - listScopes rhsScope (map (\hsps -> L (getLoc $ hsps_body hsps) hsps) xs) + listScopes rhsScope (map (\(HsConPatTyArg _ hsps) -> L (getLoc $ hsps_body hsps) hsps) xs) -- We make the HsPatSigType into a Located one by using the location of the underlying LHsType. -- We then strip off the redundant location information afterward, and take the union of the given scope and those to the right when forming the TS. @@ -964,7 +964,7 @@ instance HiePass p => ToHie (PScoped (LocatedA (Pat (GhcPass p)))) where LazyPat _ p -> [ toHie $ PS rsp scope pscope p ] - AsPat _ lname pat -> + AsPat _ lname _ pat -> [ toHie $ C (PatternBind scope (combineScopes (mkLScopeA pat) pscope) rsp) @@ -1039,9 +1039,11 @@ instance HiePass p => ToHie (PScoped (LocatedA (Pat (GhcPass p)))) where ] ExpansionPat _ p -> [ toHie $ PS rsp scope pscope (L ospan p) ] where - contextify :: a ~ LPat (GhcPass p) => HsConDetails (HsPatSigType GhcRn) a (HsRecFields (GhcPass p) a) + contextify :: a ~ LPat (GhcPass p) => HsConDetails (HsConPatTyArg GhcRn) a (HsRecFields (GhcPass p) a) -> HsConDetails (TScoped (HsPatSigType GhcRn)) (PScoped a) (RContext (HsRecFields (GhcPass p) (PScoped a))) - contextify (PrefixCon tyargs args) = PrefixCon (tScopes scope argscope tyargs) (patScopes rsp scope pscope args) + contextify (PrefixCon tyargs args) = + PrefixCon (taScopes scope argscope tyargs) + (patScopes rsp scope pscope args) where argscope = foldr combineScopes NoScope $ map mkLScopeA args contextify (InfixCon a b) = InfixCon a' b' where [a', b'] = patScopes rsp scope pscope [a,b] @@ -1105,7 +1107,7 @@ instance HiePass p => ToHie (LocatedA (HsExpr (GhcPass p))) where [ toHie a , toHie b ] - HsAppType _ expr sig -> + HsAppType _ expr _ sig -> [ toHie expr , toHie $ TS (ResolvedScopes []) sig ] |