Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion henforcer.cabal
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cabal-version: 3.4

name: henforcer
version: 1.0.0.1
version: 1.0.0.2
synopsis: GHC plugin to enforce user specified rules on code.
description: Please see the README on GitHub at <https://github.com/flipstone/henforcer#readme>
category: Development, Compiler Plugin, static-analysis
Expand Down
2 changes: 2 additions & 0 deletions src/CompatGHC.hs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ module CompatGHC
, SrcSpan
, generatedSrcSpan
, getLoc
, isGoodSrcSpan
, ideclAs
, ideclName
, ideclPkgQual
Expand Down Expand Up @@ -110,6 +111,7 @@ import GHC
, ideclPkgQual
, ideclQualified
, ideclSafe
, isGoodSrcSpan
, locA
, mkModuleName
, moduleName
Expand Down
11 changes: 10 additions & 1 deletion src/Henforcer/CodeStructure/Import/Import.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ module Henforcer.CodeStructure.Import.Import
, importIsOpenWithNoHidingOrAlias
) where

import qualified Data.Maybe as Maybe

import qualified CompatGHC
import Henforcer.CodeStructure.Import.Scheme (Alias (WithoutAlias), Scheme (Scheme), buildScheme)

Expand Down Expand Up @@ -48,7 +50,14 @@ getImports tcGblEnv =
let
name = CompatGHC.moduleName $ CompatGHC.tcg_mod tcGblEnv
in
fmap (Import name) $ CompatGHC.tcg_rn_imports tcGblEnv
Maybe.mapMaybe
( \imp ->
-- Remove synthetic imports, e.g. transitively imported Backpack signatures
if CompatGHC.isGoodSrcSpan . CompatGHC.locA $ CompatGHC.getLoc imp
then Just (Import name imp)
else Nothing
)
(CompatGHC.tcg_rn_imports tcGblEnv)

{- | Determine if the import is open, with no qualification, no alias, and no hiding

Expand Down