Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes to avoid GHC warnings on building #521

Merged
merged 1 commit into from
Oct 14, 2023
Merged
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 src/Stan/Ghc/Compat810.hs
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,5 @@ import qualified Data.Text as T
showTUnitId :: UnitId -> Text
showTUnitId = T.pack . unitIdString
#else
where
() where
#endif
1 change: 1 addition & 0 deletions src/Stan/Hie.hs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ module Stan.Hie
) where

import Colourista (errorMessage, infoMessage, warningMessage)
import Prelude hiding (span)
import System.Directory (doesDirectoryExist, doesFileExist)
import System.Directory.Recursive (getDirRecursive)
import System.FilePath (takeExtension)
Expand Down
18 changes: 9 additions & 9 deletions src/Stan/Hie/MatchAst.hs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module Stan.Hie.MatchAst
) where

import Data.Char (toLower)

import Prelude hiding (span)
import Stan.Core.List (checkWith)
import Stan.Ghc.Compat (nameOccName, occNameString)
import Stan.Hie (slice)
Expand Down Expand Up @@ -54,7 +54,7 @@ hieMatchPatternAst hie@HieFile{..} node@Node{..} = \case
hieMatchPatternAst hie node p1
&& hieMatchPatternAst hie node p2
PatternAstConstant lit ->
Set.member literalAnns (Set.map toNodeAnnotation (nodeAnnotations nodeInfo))
Set.member literalAnns (Set.map toNodeAnnotation (nodeAnnotations nodeInfo'))
&& ( let span = slice nodeSpan hie_hs_src in case lit of
ExactNum n -> (span >>= readMaybe . decodeUtf8) == Just n
ExactStr s -> span == Just s
Expand All @@ -65,26 +65,26 @@ hieMatchPatternAst hie@HieFile{..} node@Node{..} = \case
PatternAstName nameMeta patType ->
any (matchNameAndType nameMeta patType)
$ Map.assocs
$ nodeIdentifiers nodeInfo
$ nodeIdentifiers nodeInfo'
PatternAstNode tags ->
matchAnnotations tags nodeInfo
matchAnnotations tags nodeInfo'
PatternAstNodeExact tags patChildren ->
matchAnnotations tags nodeInfo
matchAnnotations tags nodeInfo'
&& checkWith (hieMatchPatternAst hie) nodeChildren patChildren
PatternAstVarName varName -> isJust $ find
(\case
Right x -> varName `Str.isInfixOf` map toLower (occNameString $ nameOccName x)
Left _ -> False
)
$ Map.keys $ nodeIdentifiers nodeInfo
$ Map.keys $ nodeIdentifiers nodeInfo'
PatternAstIdentifierDetailsDecl declType -> any (any (isDecl declType) . identInfo) $
Map.elems $ nodeIdentifiers nodeInfo
Map.elems $ nodeIdentifiers nodeInfo'
where
matchAnnotations :: Set NodeAnnotation -> NodeInfo TypeIndex -> Bool
matchAnnotations tags NodeInfo{..} =
tags `Set.isSubsetOf` Set.map toNodeAnnotation nodeAnnotations

nodeInfo = Stan.Hie.Compat.nodeInfo node
nodeInfo' = Stan.Hie.Compat.nodeInfo node
tomjaguarpaw marked this conversation as resolved.
Show resolved Hide resolved

matchNameAndType
:: NameMeta
Expand All @@ -93,7 +93,7 @@ hieMatchPatternAst hie@HieFile{..} node@Node{..} = \case
-> Bool
matchNameAndType nameMeta patType ids =
hieMatchNameMeta nameMeta ids
&& case nodeType nodeInfo of
&& case nodeType nodeInfo' of
[] -> False
t : _ -> hieMatchPatternType hie_types patType t

Expand Down
1 change: 1 addition & 0 deletions src/Stan/Pattern/Ast.hs
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ foo :: Some -> Type
typeSig :: PatternAst
typeSig = PatternAstNode $ one (mkNodeAnnotation "TypeSig" "Sig")

absBinds :: NodeAnnotation
absBinds =
#if __GLASGOW_HASKELL__ < 904
mkNodeAnnotation "AbsBinds" "HsBindLR"
Expand Down
2 changes: 2 additions & 0 deletions src/Stan/Pattern/Type.hs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
listFunPattern = listPattern |-> (?)

-- | 'PatternType' for 'Integer'.
integerPattern :: PatternType
integerPattern =
#if __GLASGOW_HASKELL__ < 900
integerPattern810
Expand All @@ -115,6 +116,7 @@
#endif

-- | 'PatternType' for 'Natural'.
naturalPattern :: PatternType
naturalPattern =
#if __GLASGOW_HASKELL__ < 900
naturalPattern810
Expand All @@ -123,24 +125,24 @@
#endif

integerPattern810 :: PatternType
integerPattern810 = NameMeta

Check warning on line 128 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / ubuntu-latest / ghc 9.4.7

Defined but not used: ‘integerPattern810’

Check warning on line 128 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / ubuntu-latest / ghc 9.4.5

Defined but not used: ‘integerPattern810’

Check warning on line 128 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / ubuntu-latest / ghc 9.4.1

Defined but not used: ‘integerPattern810’

Check warning on line 128 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / ubuntu-latest / ghc 9.0.1

Defined but not used: ‘integerPattern810’

Check warning on line 128 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / ubuntu-latest / ghc 9.4.4

Defined but not used: ‘integerPattern810’

Check warning on line 128 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / ubuntu-latest / ghc 9.2.3

Defined but not used: ‘integerPattern810’

Check warning on line 128 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / ubuntu-latest / ghc 9.0.2

Defined but not used: ‘integerPattern810’

Check warning on line 128 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / ubuntu-latest / ghc 9.4.6

Defined but not used: ‘integerPattern810’

Check warning on line 128 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / ubuntu-latest / ghc 9.4.2

Defined but not used: ‘integerPattern810’

Check warning on line 128 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / macOS-latest / ghc 9.0.2

Defined but not used: ‘integerPattern810’

Check warning on line 128 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / macOS-latest / ghc 9.0.1

Defined but not used: ‘integerPattern810’

Check warning on line 128 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / macOS-latest / ghc 9.2.3

Defined but not used: ‘integerPattern810’

Check warning on line 128 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / macOS-latest / ghc 9.4.1

Defined but not used: ‘integerPattern810’

Check warning on line 128 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / windows-latest / ghc 9.0.1

Defined but not used: ‘integerPattern810’

Check warning on line 128 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / windows-latest / ghc 9.0.2

Defined but not used: ‘integerPattern810’

Check warning on line 128 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / windows-latest / ghc 9.2.3

Defined but not used: ‘integerPattern810’

Check warning on line 128 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / windows-latest / ghc 9.4.1

Defined but not used: ‘integerPattern810’

Check warning on line 128 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / windows-latest / ghc 9.4.4

Defined but not used: ‘integerPattern810’

Check warning on line 128 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / windows-latest / ghc 9.4.6

Defined but not used: ‘integerPattern810’

Check warning on line 128 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / windows-latest / ghc 9.4.5

Defined but not used: ‘integerPattern810’

Check warning on line 128 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / windows-latest / ghc 9.4.2

Defined but not used: ‘integerPattern810’

Check warning on line 128 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / windows-latest / ghc 9.4.7

Defined but not used: ‘integerPattern810’

Check warning on line 128 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / macOS-latest / ghc 9.4.7

Defined but not used: ‘integerPattern810’

Check warning on line 128 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / macOS-latest / ghc 9.4.2

Defined but not used: ‘integerPattern810’

Check warning on line 128 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / macOS-latest / ghc 9.4.5

Defined but not used: ‘integerPattern810’

Check warning on line 128 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / macOS-latest / ghc 9.4.6

Defined but not used: ‘integerPattern810’

Check warning on line 128 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / macOS-latest / ghc 9.4.4

Defined but not used: ‘integerPattern810’
{ nameMetaName = "Integer"
, nameMetaModuleName = "GHC.Integer.Type"
, nameMetaPackage = "integer-wired-in"
} |:: []

integerPattern900 :: PatternType
integerPattern900 = NameMeta

Check warning on line 135 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / stack / ghc 8.10.7

Defined but not used: ‘integerPattern900’

Check warning on line 135 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / ubuntu-latest / ghc 8.8.4

Defined but not used: ‘integerPattern900’

Check warning on line 135 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / ubuntu-latest / ghc 8.10.7

Defined but not used: ‘integerPattern900’

Check warning on line 135 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / macOS-latest / ghc 8.10.7

Defined but not used: ‘integerPattern900’

Check warning on line 135 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / windows-latest / ghc 8.10.7

Defined but not used: ‘integerPattern900’
{ nameMetaName = "Integer"
, nameMetaModuleName = "GHC.Num.Integer"
, nameMetaPackage = "ghc-bignum"
} |:: []

naturalPattern810 :: PatternType
naturalPattern810 = "Natural" `baseNameFrom` "GHC.Natural" |:: []

Check warning on line 142 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / ubuntu-latest / ghc 9.4.7

Defined but not used: ‘naturalPattern810’

Check warning on line 142 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / ubuntu-latest / ghc 9.4.5

Defined but not used: ‘naturalPattern810’

Check warning on line 142 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / ubuntu-latest / ghc 9.4.1

Defined but not used: ‘naturalPattern810’

Check warning on line 142 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / ubuntu-latest / ghc 9.0.1

Defined but not used: ‘naturalPattern810’

Check warning on line 142 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / ubuntu-latest / ghc 9.4.4

Defined but not used: ‘naturalPattern810’

Check warning on line 142 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / ubuntu-latest / ghc 9.2.3

Defined but not used: ‘naturalPattern810’

Check warning on line 142 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / ubuntu-latest / ghc 9.0.2

Defined but not used: ‘naturalPattern810’

Check warning on line 142 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / ubuntu-latest / ghc 9.4.6

Defined but not used: ‘naturalPattern810’

Check warning on line 142 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / ubuntu-latest / ghc 9.4.2

Defined but not used: ‘naturalPattern810’

Check warning on line 142 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / macOS-latest / ghc 9.0.2

Defined but not used: ‘naturalPattern810’

Check warning on line 142 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / macOS-latest / ghc 9.0.1

Defined but not used: ‘naturalPattern810’

Check warning on line 142 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / macOS-latest / ghc 9.2.3

Defined but not used: ‘naturalPattern810’

Check warning on line 142 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / macOS-latest / ghc 9.4.1

Defined but not used: ‘naturalPattern810’

Check warning on line 142 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / windows-latest / ghc 9.0.1

Defined but not used: ‘naturalPattern810’

Check warning on line 142 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / windows-latest / ghc 9.0.2

Defined but not used: ‘naturalPattern810’

Check warning on line 142 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / windows-latest / ghc 9.2.3

Defined but not used: ‘naturalPattern810’

Check warning on line 142 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / windows-latest / ghc 9.4.1

Defined but not used: ‘naturalPattern810’

Check warning on line 142 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / windows-latest / ghc 9.4.4

Defined but not used: ‘naturalPattern810’

Check warning on line 142 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / windows-latest / ghc 9.4.6

Defined but not used: ‘naturalPattern810’

Check warning on line 142 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / windows-latest / ghc 9.4.5

Defined but not used: ‘naturalPattern810’

Check warning on line 142 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / windows-latest / ghc 9.4.2

Defined but not used: ‘naturalPattern810’

Check warning on line 142 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / windows-latest / ghc 9.4.7

Defined but not used: ‘naturalPattern810’

Check warning on line 142 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / macOS-latest / ghc 9.4.7

Defined but not used: ‘naturalPattern810’

Check warning on line 142 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / macOS-latest / ghc 9.4.2

Defined but not used: ‘naturalPattern810’

Check warning on line 142 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / macOS-latest / ghc 9.4.5

Defined but not used: ‘naturalPattern810’

Check warning on line 142 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / macOS-latest / ghc 9.4.6

Defined but not used: ‘naturalPattern810’

Check warning on line 142 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / macOS-latest / ghc 9.4.4

Defined but not used: ‘naturalPattern810’

naturalPattern900 :: PatternType
naturalPattern900 = NameMeta

Check warning on line 145 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / stack / ghc 8.10.7

Defined but not used: ‘naturalPattern900’

Check warning on line 145 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / ubuntu-latest / ghc 8.8.4

Defined but not used: ‘naturalPattern900’

Check warning on line 145 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / ubuntu-latest / ghc 8.10.7

Defined but not used: ‘naturalPattern900’

Check warning on line 145 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / macOS-latest / ghc 8.10.7

Defined but not used: ‘naturalPattern900’

Check warning on line 145 in src/Stan/Pattern/Type.hs

View workflow job for this annotation

GitHub Actions / windows-latest / ghc 8.10.7

Defined but not used: ‘naturalPattern900’
{ nameMetaName = "Natural"
, nameMetaModuleName = "GHC.Num.Natural"
, nameMetaPackage = "ghc-bignum"
Expand Down
Loading