diff --git a/Cabal-tests/tests/ParserTests/regressions/issue-6288-d.check b/Cabal-tests/tests/ParserTests/regressions/issue-6288-d.check index 64c183826b5..0498704b284 100644 --- a/Cabal-tests/tests/ParserTests/regressions/issue-6288-d.check +++ b/Cabal-tests/tests/ParserTests/regressions/issue-6288-d.check @@ -1 +1 @@ -[no-default-language] Packages using 'cabal-version: >= 1.10' and before 'cabal-version: 3.4' must specify the 'default-language' field for each component (e.g. Haskell98 or Haskell2010). If a component uses different languages in different modules then list the other ones in the 'other-languages' field. +[no-default-language] Packages using 'cabal-version: >= 1.10' must specify the 'default-language' field for each component (e.g. Haskell98 or Haskell2010). If a component uses different languages in different modules then list the other ones in the 'other-languages' field. diff --git a/Cabal/src/Distribution/PackageDescription/Check/Target.hs b/Cabal/src/Distribution/PackageDescription/Check/Target.hs index e6cfba74928..f15cd608c34 100644 --- a/Cabal/src/Distribution/PackageDescription/Check/Target.hs +++ b/Cabal/src/Distribution/PackageDescription/Check/Target.hs @@ -485,7 +485,6 @@ checkBuildInfoFeatures bi sv = do -- CheckSpecVer sv. checkP ( sv >= CabalSpecV1_10 - && sv < CabalSpecV3_4 && isNothing (defaultLanguage bi) ) (PackageBuildWarning CVDefaultLanguageComponent) diff --git a/Cabal/src/Distribution/PackageDescription/Check/Warning.hs b/Cabal/src/Distribution/PackageDescription/Check/Warning.hs index f7a048f7913..7ff5b50de13 100644 --- a/Cabal/src/Distribution/PackageDescription/Check/Warning.hs +++ b/Cabal/src/Distribution/PackageDescription/Check/Warning.hs @@ -1158,7 +1158,7 @@ ppExplanation CVDefaultLanguage = "To use the 'default-language' field the package needs to specify " ++ "at least 'cabal-version: >= 1.10'." ppExplanation CVDefaultLanguageComponent = - "Packages using 'cabal-version: >= 1.10' and before 'cabal-version: 3.4' " + "Packages using 'cabal-version: >= 1.10' " ++ "must specify the 'default-language' field for each component (e.g. " ++ "Haskell98 or Haskell2010). If a component uses different languages " ++ "in different modules then list the other ones in the " diff --git a/cabal-testsuite/PackageTests/Check/ConfiguredPackage/CabalVersion/DefaultLanguageSpec/cabal.out b/cabal-testsuite/PackageTests/Check/ConfiguredPackage/CabalVersion/DefaultLanguageSpec/cabal.out index cc237924935..49fcc3afb6f 100644 --- a/cabal-testsuite/PackageTests/Check/ConfiguredPackage/CabalVersion/DefaultLanguageSpec/cabal.out +++ b/cabal-testsuite/PackageTests/Check/ConfiguredPackage/CabalVersion/DefaultLanguageSpec/cabal.out @@ -1,4 +1,4 @@ # cabal check The following errors are likely to affect your build negatively: -Error: [no-default-language] Packages using 'cabal-version: >= 1.10' and before 'cabal-version: 3.4' must specify the 'default-language' field for each component (e.g. Haskell98 or Haskell2010). If a component uses different languages in different modules then list the other ones in the 'other-languages' field. +Error: [no-default-language] Packages using 'cabal-version: >= 1.10' must specify the 'default-language' field for each component (e.g. Haskell98 or Haskell2010). If a component uses different languages in different modules then list the other ones in the 'other-languages' field. Error: Hackage would reject this package. diff --git a/cabal-testsuite/PackageTests/Check/ConfiguredPackage/CabalVersion/DefaultLanguageSpec/pkg.cabal b/cabal-testsuite/PackageTests/Check/ConfiguredPackage/CabalVersion/DefaultLanguageSpec/pkg.cabal index d1e86489db5..f89c160813a 100644 --- a/cabal-testsuite/PackageTests/Check/ConfiguredPackage/CabalVersion/DefaultLanguageSpec/pkg.cabal +++ b/cabal-testsuite/PackageTests/Check/ConfiguredPackage/CabalVersion/DefaultLanguageSpec/pkg.cabal @@ -1,4 +1,4 @@ -cabal-version: 3.0 +cabal-version: 3.4 name: pkg synopsis: synopsis description: description diff --git a/cabal-testsuite/PackageTests/Project/CoverageProject/cabal.out b/cabal-testsuite/PackageTests/Project/CoverageProject/cabal.out index 1278857b31d..f6afdb5e560 100644 --- a/cabal-testsuite/PackageTests/Project/CoverageProject/cabal.out +++ b/cabal-testsuite/PackageTests/Project/CoverageProject/cabal.out @@ -5,11 +5,9 @@ In order, the following will be built: - pkg-a-0.1 (lib) (first run) - pkg-a-0.1 (test:testing) (first run) Configuring library for pkg-a-0.1... -Warning: [no-default-language] Packages using 'cabal-version: >= 1.10' and before 'cabal-version: 3.4' must specify the 'default-language' field for each component (e.g. Haskell98 or Haskell2010). If a component uses different languages in different modules then list the other ones in the 'other-languages' field. Preprocessing library for pkg-a-0.1... Building library for pkg-a-0.1... Configuring test suite 'testing' for pkg-a-0.1... -Warning: [no-default-language] Packages using 'cabal-version: >= 1.10' and before 'cabal-version: 3.4' must specify the 'default-language' field for each component (e.g. Haskell98 or Haskell2010). If a component uses different languages in different modules then list the other ones in the 'other-languages' field. Preprocessing test suite 'testing' for pkg-a-0.1... Building test suite 'testing' for pkg-a-0.1... Running 1 test suites... diff --git a/cabal-testsuite/PackageTests/Project/CoverageProject/pkg-a/pkg-a.cabal b/cabal-testsuite/PackageTests/Project/CoverageProject/pkg-a/pkg-a.cabal index 4a064d3389c..8226cc1a54d 100644 --- a/cabal-testsuite/PackageTests/Project/CoverageProject/pkg-a/pkg-a.cabal +++ b/cabal-testsuite/PackageTests/Project/CoverageProject/pkg-a/pkg-a.cabal @@ -20,4 +20,5 @@ test-suite testing build-depends: base, pkg-a main-is: Main.hs hs-source-dirs: test + default-language: Haskell2010 diff --git a/cabal-testsuite/PackageTests/Regression/T6440/cabal.out b/cabal-testsuite/PackageTests/Regression/T6440/cabal.out index 5c24cecf81f..23cfe47a187 100644 --- a/cabal-testsuite/PackageTests/Regression/T6440/cabal.out +++ b/cabal-testsuite/PackageTests/Regression/T6440/cabal.out @@ -6,15 +6,12 @@ In order, the following will be built: - cabal6440-0.1 (lib) (first run) - cabal6440-0.1 (test:tests) (first run) Configuring library 'intern6440' for cabal6440-0.1... -Warning: [no-default-language] Packages using 'cabal-version: >= 1.10' and before 'cabal-version: 3.4' must specify the 'default-language' field for each component (e.g. Haskell98 or Haskell2010). If a component uses different languages in different modules then list the other ones in the 'other-languages' field. Preprocessing library 'intern6440' for cabal6440-0.1... Building library 'intern6440' for cabal6440-0.1... Configuring library for cabal6440-0.1... -Warning: [no-default-language] Packages using 'cabal-version: >= 1.10' and before 'cabal-version: 3.4' must specify the 'default-language' field for each component (e.g. Haskell98 or Haskell2010). If a component uses different languages in different modules then list the other ones in the 'other-languages' field. Preprocessing library for cabal6440-0.1... Building library for cabal6440-0.1... Configuring test suite 'tests' for cabal6440-0.1... -Warning: [no-default-language] Packages using 'cabal-version: >= 1.10' and before 'cabal-version: 3.4' must specify the 'default-language' field for each component (e.g. Haskell98 or Haskell2010). If a component uses different languages in different modules then list the other ones in the 'other-languages' field. Preprocessing test suite 'tests' for cabal6440-0.1... Building test suite 'tests' for cabal6440-0.1... Running 1 test suites... diff --git a/cabal-testsuite/PackageTests/Regression/T6440/cabal6440.cabal b/cabal-testsuite/PackageTests/Regression/T6440/cabal6440.cabal index 42192a71672..5c2fc9483c2 100644 --- a/cabal-testsuite/PackageTests/Regression/T6440/cabal6440.cabal +++ b/cabal-testsuite/PackageTests/Regression/T6440/cabal6440.cabal @@ -13,6 +13,7 @@ library intern6440 exposed-modules: Inn build-depends: base hs-source-dirs: srcint + default-language: Haskell2010 test-suite tests diff --git a/cabal-testsuite/PackageTests/Regression/T9122/p/p.cabal b/cabal-testsuite/PackageTests/Regression/T9122/p/p.cabal index 1100690129a..9a9d78e9bbb 100644 --- a/cabal-testsuite/PackageTests/Regression/T9122/p/p.cabal +++ b/cabal-testsuite/PackageTests/Regression/T9122/p/p.cabal @@ -4,3 +4,4 @@ Version: 2 Build-Type: Simple library + default-language: Haskell2010 diff --git a/cabal-testsuite/PackageTests/Regression/T9122/q/q.cabal b/cabal-testsuite/PackageTests/Regression/T9122/q/q.cabal index d9bd9b331e5..4f3ed32ba29 100644 --- a/cabal-testsuite/PackageTests/Regression/T9122/q/q.cabal +++ b/cabal-testsuite/PackageTests/Regression/T9122/q/q.cabal @@ -5,6 +5,8 @@ Build-Type: Simple library build-depends: q:p + default-language: Haskell2010 library p build-depends: p:p == 2 + default-language: Haskell2010 diff --git a/changelog.d/pr-9621 b/changelog.d/pr-9621 new file mode 100644 index 00000000000..407f92b779f --- /dev/null +++ b/changelog.d/pr-9621 @@ -0,0 +1,9 @@ +synopsis: Warn about missing `default-language` +packages: Cabal cabal-install +prs: #9621 +issues: #9620 +description: { + +- `cabal check` will warn about missing `default-language` and not assume `Haskell 2010`. + +}