haskell-tools-backend-ghc 0.3.0.1 → 0.4.0.0
raw patch · 4 files changed
+11/−8 lines, 4 filesdep ~haskell-tools-astPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: haskell-tools-ast
API changes (from Hackage documentation)
Files
- Language/Haskell/Tools/AST/FromGHC/AddTypeInfo.hs +1/−1
- Language/Haskell/Tools/AST/FromGHC/Binds.hs +3/−3
- Language/Haskell/Tools/AST/FromGHC/Modules.hs +5/−2
- haskell-tools-backend-ghc.cabal +2/−2
Language/Haskell/Tools/AST/FromGHC/AddTypeInfo.hs view
@@ -42,7 +42,7 @@ let createCName sc def id = mkCNameInfo sc def id fixity where fixity = if any (any ((getOccName id ==) . getOccName)) (init sc) then Nothing - else fmap (snd . snd) $ List.find (\(mod,(occ,_)) -> mod == (nameModule $ varName id) && occ == getOccName id) fixities + else fmap (snd . snd) $ List.find (\(mod,(occ,_)) -> Just mod == (nameModule_maybe $ varName id) && occ == getOccName id) fixities evalStateT (semaTraverse (AST.SemaTrf (\ni -> case (AST.semanticsSourceInfo ni, AST.semanticsName ni) of
Language/Haskell/Tools/AST/FromGHC/Binds.hs view
@@ -102,15 +102,15 @@ trfLocalBinds :: TransformName n r => HsLocalBinds n -> Trf (AnnListG AST.ULocalBind (Dom r) RangeStage) trfLocalBinds (HsValBinds (ValBindsIn binds sigs)) - = makeIndentedList (after AnnWhere) + = makeIndentedListBefore " " (after AnnWhere) (orderDefs <$> ((++) <$> mapM (copyAnnot AST.ULocalValBind . trfBind) (bagToList binds) <*> mapM trfLocalSig sigs)) trfLocalBinds (HsValBinds (ValBindsOut binds sigs)) - = makeIndentedList (after AnnWhere) + = makeIndentedListBefore " " (after AnnWhere) (orderDefs <$> ((++) <$> (concat <$> mapM (mapM (copyAnnot AST.ULocalValBind . trfBind) . bagToList . snd) binds) <*> mapM trfLocalSig sigs)) trfLocalBinds (HsIPBinds (IPBinds binds _)) - = makeIndentedList (after AnnWhere) (mapM trfIpBind binds) + = makeIndentedListBefore " " (after AnnWhere) (mapM trfIpBind binds) trfIpBind :: TransformName n r => Located (IPBind n) -> Trf (Ann AST.ULocalBind (Dom r) RangeStage) trfIpBind = trfLocNoSema $ \case
Language/Haskell/Tools/AST/FromGHC/Modules.hs view
@@ -124,13 +124,16 @@ env <- liftGhc getSession locals <- asks ((hsGetNames group ++) . concat . localsInScope) - let readEnv = mkOccEnv (map (\n -> (GHC.occName n, [GRE n NoParent False [ImpSpec (ImpDeclSpec (moduleName $ nameModule n) (moduleName $ nameModule n) False noSrcSpan) ImpAll]])) locals) + let createGRE n | Just modName <- nameModule_maybe n + = [GRE n NoParent False [ImpSpec (ImpDeclSpec (moduleName modName) (moduleName modName) False noSrcSpan) ImpAll]] + | otherwise = [] + readEnv = mkOccEnv (map (\n -> (GHC.occName n, createGRE n)) locals) tcdSplices <- liftIO $ runTcInteractive env { hsc_dflags = xopt_set (hsc_dflags env) TemplateHaskellQuotes } $ updGblEnv (\gbl -> gbl { tcg_rdr_env = readEnv }) $ (,,) <$> mapM tcHsSplice declSpls <*> mapM tcHsSplice' typeSpls <*> mapM tcHsSplice' exprSpls let (declSplices, typeSplices, exprSplices) - = fromMaybe (error $ "USplice expression could not be typechecked: " + = fromMaybe (error $ "Splice expression could not be typechecked: " ++ showSDocUnsafe (vcat (pprErrMsgBagWithLoc (fst (fst tcdSplices))) <+> vcat (pprErrMsgBagWithLoc (snd (fst tcdSplices))))) (snd tcdSplices)
haskell-tools-backend-ghc.cabal view
@@ -1,5 +1,5 @@ name: haskell-tools-backend-ghc -version: 0.3.0.1 +version: 0.4.0.0 synopsis: Creating the Haskell-Tools AST from GHC's representations description: This package collects information from various representations of a Haskell program in GHC. Basically GHC provides us with the parsed, the renamed and the type checked representation of the program, if it was type correct. Each version contains different information. For example, the renamed AST contains the unique names of the definitions, however, template haskell splices are already resolved and thus missing from that version of the AST. To get the final representation we perform a transformation on the parsed and renamed representation, and then use the type checked one to look up the types of the names. The whole transformation is defined in the `Modules` module. Other modules define the functions that convert elements of the GHC AST to our AST. homepage: https://github.com/nboldi/haskell-tools @@ -41,5 +41,5 @@ , split >= 0.2 && < 0.3 , template-haskell >= 2.11 && < 2.12 , ghc >= 8.0 && < 8.1 - , haskell-tools-ast >= 0.3 && < 0.4 + , haskell-tools-ast >= 0.4 && < 0.5 default-language: Haskell2010