Skip to content

Commit

Permalink
Make check recognise TypeAbstractions
Browse files Browse the repository at this point in the history
See #9496.

“Backport” of #9502, notice that we are not adding a new constructor,
just tweaking `check` behaviour.  This is improve UX without breaking
changes.
  • Loading branch information
ffaf1 committed Dec 8, 2023
1 parent 5d97fcf commit 25f972d
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Cabal/src/Distribution/PackageDescription/Check.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1193,9 +1193,10 @@ checkFields pkg =
unknownCompilers = [ name | (OtherCompiler name, _) <- testedWith pkg ]
unknownLanguages = [ name | bi <- allBuildInfo pkg
, UnknownLanguage name <- allLanguages bi ]
unknownExtensions = [ name | bi <- allBuildInfo pkg
, UnknownExtension name <- allExtensions bi
, name `notElem` map prettyShow knownLanguages ]
unknownExtensions = filter (/= "TypeAbstractions")
[ name | bi <- allBuildInfo pkg
, UnknownExtension name <- allExtensions bi
, name `notElem` map prettyShow knownLanguages ]
ourDeprecatedExtensions = nub $ catMaybes
[ find ((==ext) . fst) deprecatedExtensions
| bi <- allBuildInfo pkg
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# cabal check
No errors or warnings could be found in the package.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Test.Cabal.Prelude

-- Uknown extension, exception for TypeAbstractions, see #9496
main = cabalTest $
cabal "check" []
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
cabal-version: 3.0
name: pkg
synopsis: synopsis
description: description
version: 0
category: example
maintainer: [email protected]
license: GPL-3.0-or-later

library
exposed-modules: Module
default-language: Haskell2010
default-extensions: TypeAbstractions
11 changes: 11 additions & 0 deletions changelog.d/pr-9503
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
synopsis: Make `check` recognise `TypeAbstractions`
packages: cabal-install
prs: #9503
issues: #9496

description: {

- `cabal check` will not complain about “Unknown extension” when
finding `TypeAbstractions`.

}
2 changes: 2 additions & 0 deletions editors/vim/syntax/cabal.vim
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ syn keyword cabalExtension contained
\ TraditionalRecordSyntax
\ TransformListComp
\ TupleSections
\ TypeAbstractions
\ TypeApplications
\ TypeData
\ TypeFamilies
Expand Down Expand Up @@ -405,6 +406,7 @@ syn keyword cabalExtension contained
\ NoTraditionalRecordSyntax
\ NoTransformListComp
\ NoTupleSections
\ NoTypeAbstractions
\ NoTypeApplications
\ NoTypeFamilies
\ NoTypeFamilyDependencies
Expand Down

0 comments on commit 25f972d

Please sign in to comment.