|
15 | 15 |
|
16 | 16 | {-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}
|
17 | 17 |
|
18 |
| -module Compat.HieAst ( enrichHie ) where |
19 |
| - |
20 |
| --- import GHC.Iface.Ext.Ast (enrichHie) |
21 |
| - |
| 18 | +{- |
| 19 | +Forked from GHC v9.2.3 to include record-dot-syntax type information in .hie files. |
22 | 20 |
|
| 21 | +Changes are marked with "CHANGED:" |
23 | 22 |
|
24 |
| -{- |
25 | 23 | Main functions for .hie file generation
|
26 | 24 | -}
|
27 | 25 |
|
| 26 | +-- CHANGED: removed this include and updated the module declaration |
28 | 27 | -- #include "HsVersions.h"
|
29 |
| - |
| 28 | +-- |
30 | 29 | -- module GHC.Iface.Ext.Ast ( mkHieFile, mkHieFileWithSource, getCompressedAsts, enrichHie) where
|
31 | 30 |
|
| 31 | +module Compat.HieAst ( enrichHie ) where |
| 32 | + |
32 | 33 | import GHC.Utils.Outputable(ppr)
|
33 | 34 |
|
34 | 35 | import GHC.Prelude
|
@@ -786,6 +787,7 @@ instance HiePass p => HasType (LocatedA (HsExpr (GhcPass p))) where
|
786 | 787 | HsOverLabel{} -> False
|
787 | 788 | HsIPVar{} -> False
|
788 | 789 | XExpr (WrapExpr {}) -> False
|
| 790 | + -- CHANGED: the line below makes record-dot-syntax types work |
789 | 791 | XExpr (ExpansionExpr {}) -> False
|
790 | 792 | _ -> True
|
791 | 793 |
|
@@ -918,6 +920,8 @@ instance HiePass p => ToHie (Located (PatSynBind (GhcPass p) (GhcPass p))) where
|
918 | 920 | detSpan = case detScope of
|
919 | 921 | LocalScope a -> Just a
|
920 | 922 | _ -> Nothing
|
| 923 | + -- CHANGED: removed ASSERT |
| 924 | + -- toBind (PrefixCon ts args) = ASSERT(null ts) PrefixCon ts $ map (C Use) args |
921 | 925 | toBind (PrefixCon ts args) = PrefixCon ts $ map (C Use) args
|
922 | 926 | toBind (InfixCon a b) = InfixCon (C Use a) (C Use b)
|
923 | 927 | toBind (RecCon r) = RecCon $ map (PSC detSpan) r
|
@@ -1037,8 +1041,10 @@ instance HiePass p => ToHie (PScoped (LocatedA (Pat (GhcPass p)))) where
|
1037 | 1041 | in [ toHie $ L ospan wrap
|
1038 | 1042 | , toHie $ PS rsp scope pscope $ (L ospan pat)
|
1039 | 1043 | ]
|
1040 |
| - |
1041 |
| - |
| 1044 | +-- CHANGED: removed preprocessor stuff |
| 1045 | +-- #if __GLASGOW_HASKELL__ < 811 |
| 1046 | +-- HieRn -> [] |
| 1047 | +-- #endif |
1042 | 1048 | where
|
1043 | 1049 | contextify :: a ~ LPat (GhcPass p) => HsConDetails (HsPatSigType (NoGhcTc (GhcPass p))) a (HsRecFields (GhcPass p) a)
|
1044 | 1050 | -> HsConDetails (TScoped (HsPatSigType (NoGhcTc (GhcPass p)))) (PScoped a) (RContext (HsRecFields (GhcPass p) (PScoped a)))
|
@@ -1923,7 +1929,11 @@ instance HiePass p => ToHie (LocatedA (HsSplice (GhcPass p))) where
|
1923 | 1929 | HsSpliced _ _ _ ->
|
1924 | 1930 | []
|
1925 | 1931 | XSplice x -> case ghcPass @p of
|
1926 |
| - |
| 1932 | +-- CHANGED: removed preprocessor stuff |
| 1933 | +-- #if __GLASGOW_HASKELL__ < 811 |
| 1934 | +-- GhcPs -> noExtCon x |
| 1935 | +-- GhcRn -> noExtCon x |
| 1936 | +-- #endif |
1927 | 1937 | GhcTc -> case x of
|
1928 | 1938 | HsSplicedT _ -> []
|
1929 | 1939 |
|
|
0 commit comments