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

Doctest is failing in CI #9307

Closed
geekosaur opened this issue Oct 3, 2023 · 13 comments
Closed

Doctest is failing in CI #9307

geekosaur opened this issue Oct 3, 2023 · 13 comments
Labels

Comments

@geekosaur
Copy link
Collaborator

It is not clear whether the first error leads to all the others, or if this derives from a change in the doctest CI.

Preprocessing library for Cabal-syntax-3.11.0.0..

when making flags consistent: error: [-Werror]
    Optimization flags conflict with --interactive; optimization flags ignored.
src/Distribution/InstalledPackageInfo.hs:133: failure in expression `let ipi = emptyInstalledPackageInfo { maintainer = "Tester" }'
expected: 
 but got: 
          ^
          <interactive>:35:39: error: Not in scope: ‘maintainer’

src/Distribution/FieldGrammar/Newtypes.hs:137: failure in expression `:t alaList VCat'
expected: alaList VCat :: [a] -> List VCat (Identity a) a
 but got: 
          ^
          <interactive>:1:1: error: Variable not in scope: alaList :: t0 -> t
          
          <interactive>:1:9: error: Data constructor not in scope: VCat

src/Distribution/FieldGrammar/Newtypes.hs:167: failure in expression `:t alaSet VCat'
expected: alaSet VCat :: Set a -> Set' VCat (Identity a) a
 but got: 
          ^
          <interactive>:1:1: error: Variable not in scope: alaSet :: t0 -> t
          
          <interactive>:1:8: error: Data constructor not in scope: VCat

src/Distribution/FieldGrammar/Newtypes.hs:204: failure in expression `:t alaNonEmpty VCat'
expected: alaNonEmpty VCat :: NonEmpty a -> NonEmpty' VCat (Identity a) a
 but got: 
          ^
          <interactive>:1:1: error:
              Variable not in scope: alaNonEmpty :: t0 -> t
          
          <interactive>:1:13: error: Data constructor not in scope: VCat

src/Distribution/License.hs:179: failure in expression `licenseFromSPDX . licenseToSPDX $ BSD3'
expected: BSD3
 but got: 
          ^
          <interactive>:59:1: error:
              Variable not in scope: licenseFromSPDX :: b0 -> c
          
          <interactive>:59:19: error:
              Variable not in scope: licenseToSPDX :: a0 -> b0
          
          <interactive>:59:35: error: Data constructor not in scope: BSD3

src/Distribution/Types/Dependency.hs:81: failure in expression `prettyShow $ Dependency "pkg" anyVersion mainLibSet'
expected: "pkg"
 but got: 
          ^
          <interactive>:65:1: error:
              Variable not in scope: prettyShow :: a0 -> b
          
          <interactive>:65:14: error:
              Data constructor not in scope: Dependency :: t0 -> t1 -> t2 -> a0
          
          <interactive>:65:31: error: Variable not in scope: anyVersion
          
          <interactive>:65:42: error: Variable not in scope: mainLibSet

src/Distribution/Types/Dependency.hs:112: failure in expression `simpleParsec "mylib:sub" :: Maybe Dependency'
expected: Just (Dependency (PackageName "mylib") (OrLaterVersion (mkVersion [0])) (fromNonEmpty (LSubLibName (UnqualComponentName "sub") :| [])))
 but got: 
          ^
          <interactive>:71:35: error:
              Not in scope: type constructor or class ‘Dependency’

src/Distribution/Types/ExeDependency.hs:46: failure in expression `simpleParsec "happy:happy" :: Maybe ExeDependency'
expected: Just (ExeDependency (PackageName "happy") (UnqualComponentName "happy") (OrLaterVersion (mkVersion [0])))
 but got: 
          ^
          <interactive>:77:37: error:
              Not in scope: type constructor or class ‘ExeDependency’

src/Distribution/Types/MungedPackageId.hs:81: failure in expression `import Distribution.Types.Version'
expected: 
 but got: 
          ^
          <no location info>: error:
              Could not load module ‘Distribution.Types.Version’
              It is a member of the hidden package ‘Cabal-syntax-3.8.1.0’.
              Perhaps you need to add ‘Cabal-syntax’ to the build-depends in your .cabal file.

src/Distribution/Types/PackageVersionConstraint.hs:46: failure in expression `simpleParsec "foo" :: Maybe PackageVersionConstraint'
expected: Just (PackageVersionConstraint (PackageName "foo") (OrLaterVersion (mkVersion [0])))
 but got: 
          ^
          <interactive>:91:29: error:
              Not in scope: type constructor or class ‘PackageVersionConstraint’

src/Distribution/Backpack.hs:114: failure in expression `eitherParsec "foobar" :: Either String OpenUnitId'
expected: Right (DefiniteUnitId (DefUnitId {unDefUnitId = UnitId "foobar"}))
 but got: 
          ^
          <interactive>:97:40: error:
              Not in scope: type constructor or class ‘OpenUnitId’

src/Distribution/Backpack.hs:185: failure in expression `eitherParsec "Includes2-0.1.0.0-inplace-mysql:Database.MySQL" :: Either String OpenModule'
expected: Right (OpenModule (DefiniteUnitId (DefUnitId {unDefUnitId = UnitId "Includes2-0.1.0.0-inplace-mysql"})) (ModuleName "Database.MySQL"))
 but got: 
          ^
          <interactive>:103:80: error:
              Not in scope: type constructor or class ‘OpenModule’

src/Distribution/Types/PackageId.hs:43: failure in expression `simpleParsec "foo-bar-0" :: Maybe PackageIdentifier'
expected: Just (PackageIdentifier {pkgName = PackageName "foo-bar", pkgVersion = mkVersion [0]})
 but got: 
          ^
          <interactive>:109:35: error:
              Not in scope: type constructor or class ‘PackageIdentifier’

src/Distribution/Types/Mixin.hs:47: failure in expression `simpleParsec "mylib" :: Maybe Mixin'
expected: Just (Mixin {mixinPackageName = PackageName "mylib", mixinLibraryName = LMainLibName, mixinIncludeRenaming = IncludeRenaming {includeProvidesRn = DefaultRenaming, includeRequiresRn = DefaultRenaming}})
 but got: 
          ^
          <interactive>:115:31: error:
              Not in scope: type constructor or class ‘Mixin’

src/Distribution/SPDX/License.hs:58: failure in expression `eitherParsec "BSD-3-Clause AND MIT" :: Either String License'
expected: Right (License (EAnd (ELicense (ELicenseId BSD_3_Clause) Nothing) (ELicense (ELicenseId MIT) Nothing)))
 but got: 
          ^
          <interactive>:121:54: error:
              Not in scope: type constructor or class ‘License’

src/Distribution/SPDX/LicenseId.hs:515: failure in expression `eitherParsec "BSD-3-Clause" :: Either String LicenseId'
expected: Right BSD_3_Clause
 but got: 
          ^
          <interactive>:127:46: error:
              Not in scope: type constructor or class ‘LicenseId’

src/Distribution/SPDX/LicenseId.hs:536: failure in expression `licenseIdMigrationMessage "BSD3"'
expected: "Do you mean BSD-3-Clause?"
 but got: 
          ^
          <interactive>:133:1: error:
              Variable not in scope: licenseIdMigrationMessage :: t0 -> t

src/Distribution/Types/Flag.hs:254: failure in expression `simpleParsec "" :: Maybe FlagAssignment'
expected: Just (fromList [])
 but got: 
          ^
          <interactive>:139:26: error:
              Not in scope: type constructor or class ‘FlagAssignment’

src/Distribution/Types/MungedPackageName.hs:69: failure in expression `prettyShow $ MungedPackageName "servant" LMainLibName'
expected: "servant"
 but got: 
          ^
          <interactive>:153:1: error:
              Variable not in scope: prettyShow :: a0 -> b
          
          <interactive>:153:14: error:
              Data constructor not in scope: MungedPackageName :: t0 -> t1 -> a0
          
          <interactive>:153:42: error:
              Data constructor not in scope: LMainLibName

src/Distribution/Types/MungedPackageName.hs:82: failure in expression `simpleParsec "servant" :: Maybe MungedPackageName'
expected: Just (MungedPackageName (PackageName "servant") LMainLibName)
 but got: 
          ^
          <interactive>:1[61](https://github.com/haskell/cabal/actions/runs/6396526848/job/17362485036?pr=9306#step:9:62):33: error:
              Not in scope: type constructor or class ‘MungedPackageName’

src/Distribution/Types/MungedPackageName.hs:99: failure in expression `decodeCompatPackageName "z-servant-z-lackey"'
expected: MungedPackageName (PackageName "servant") (LSubLibName (UnqualComponentName "lackey"))
 but got: 
          ^
          <interactive>:169:1: error:
              Variable not in scope: decodeCompatPackageName :: t0 -> t

src/Distribution/Types/MungedPackageName.hs:106: failure in expression `encodeCompatPackageName $ MungedPackageName "servant" (LSubLibName "lackey")'
expected: PackageName "z-servant-z-lackey"
 but got: 
          ^
          <interactive>:177:1: error:
              Variable not in scope: encodeCompatPackageName :: a0 -> b
          
          <interactive>:177:27: error:
              Data constructor not in scope: MungedPackageName :: t1 -> t2 -> a0
          
          <interactive>:177:56: error:
              Data constructor not in scope: LSubLibName :: t0 -> t2

src/Distribution/Types/PkgconfigVersion.hs:46: failure in expression `simpleParsec "1.0.2n" :: Maybe PkgconfigVersion'
expected: Just (PkgconfigVersion "1.0.2n")
 but got: 
          ^
          <interactive>:183:32: error:
              Not in scope: type constructor or class ‘PkgconfigVersion’

src/Distribution/Types/VersionRange/Internal.hs:244: failure in expression `fmap pretty (simpleParsec' CabalSpecV1_6 "== 3.2.*" :: Maybe VersionRange)'
expected: Just >=3.2 && <3.3
 but got: 
          ^
          <interactive>:189:[62](https://github.com/haskell/cabal/actions/runs/6396526848/job/17362485036?pr=9306#step:9:63): error:
              Not in scope: type constructor or class ‘VersionRange’

src/Distribution/Types/VersionRange/Internal.hs:299: failure in expression `simpleParsec "^>= 3.4" :: Maybe VersionRange'
expected: Just (MajorBoundVersion (mkVersion [3,4]))
 but got: 
          ^
          <interactive>:195:33: error:
              Not in scope: type constructor or class ‘VersionRange’

src/Distribution/Fields/Parser.hs:350: failure in expression `readFields "foo: \223"'
expected: Right [Field (Name (Position 1 1) "foo") [FieldLine (Position 1 6) "\223"]]
 but got: 
          ^
          <interactive>:213:1: error:
              Variable not in scope: readFields :: t0 -> t
              Suggested fix: Perhaps use ‘readFile’ (imported from Prelude)

src/Distribution/CabalSpecVersion.hs:120: failure in expression `cabalSpecMinimumLibraryVersion CabalSpecV3_0'
expected: [2,5]
 but got: 
          ^
          <interactive>:219:1: error:
              Variable not in scope: cabalSpecMinimumLibraryVersion :: t0 -> t
          
          <interactive>:219:32: error:
              Data constructor not in scope: CabalSpecV3_0

src/Distribution/Compat/Lens.hs:110: failure in expression `(3 :: Int) ^. getting (+2) . getting show'
expected: "5"
 but got: 
          ^
          <interactive>:225:12: error:
              Variable not in scope: (^.) :: Int -> (a2 -> c0) -> t
              Suggested fix:
                Perhaps use one of these:
                  ‘.’ (imported from Prelude), ‘^’ (imported from Prelude),
                  ‘^^’ (imported from Prelude)
          
          <interactive>:225:15: error:
              Variable not in scope: getting :: (a1 -> a1) -> b0 -> c0
              Suggested fix: Perhaps use ‘getLine’ (imported from Prelude)
          
          <interactive>:225:30: error:
              Variable not in scope: getting :: (a0 -> String) -> a2 -> b0
              Suggested fix: Perhaps use ‘getLine’ (imported from Prelude)

src/Distribution/Utils/Generic.hs:301: failure in expression `safeTail $ Data.List.dropWhileEnd (<3) [undefined, 5, 4, 3, 2, 1]'
expected: *** Exception: Prelude.undefined
          ...
 but got: 
          ^
          <interactive>:243:1: error:
              Variable not in scope: safeTail :: [a0] -> b

src/Distribution/Utils/Generic.hs:357: failure in expression `ordNub [1,2,1] :: [Int]'
expected: [1,2]
 but got: 
          ^
          <interactive>:253:1: error:
              Variable not in scope: ordNub :: [a0] -> [Int]

src/Distribution/Utils/Generic.hs:374: failure in expression `listUnion [1,2,3,4,3] [2,1,1]'
expected: [1,2,3,4,3]
 but got: 
          ^
          <interactive>:2[63](https://github.com/haskell/cabal/actions/runs/6396526848/job/17362485036?pr=9306#step:9:64):1: error:
              Variable not in scope: listUnion :: [a0] -> [a1] -> t

src/Distribution/Utils/Generic.hs:418: failure in expression `lowercase "Foobar"'
expected: "foobar"
 but got: 
          ^
          <interactive>:273:1: error:
              Variable not in scope: lowercase :: t0 -> t

src/Distribution/Utils/Generic.hs:435: failure in expression `isAsciiAlphaNum 'a''
expected: True
 but got: 
          ^
          <interactive>:283:1: error:
              Variable not in scope: isAsciiAlphaNum :: Char -> t

src/Distribution/Utils/Generic.hs:454: failure in expression `breakMaybe (readMaybe :: String -> Maybe Int) ["foo", "bar", "1", "2", "quu"]'
expected: (["foo","bar"],Just (1,["2","quu"]))
 but got: 
          ^
          <interactive>:293:1: error:
              Variable not in scope:
                breakMaybe :: (String -> Maybe Int) -> [a0] -> t
              Suggested fix: Perhaps use ‘readMaybe’ (imported from Text.Read)

src/Distribution/Utils/Generic.hs:471: failure in expression `spanMaybe listToMaybe [[1,2],[3],[],[4,5],[6,7]]'
expected: ([1,3],[[],[4,5],[6,7]])
 but got: 
          ^
          <interactive>:303:1: error:
              Variable not in scope:
                spanMaybe :: ([a0] -> Maybe a0) -> [[a1]] -> t

src/Distribution/Utils/Generic.hs:486: failure in expression `take 5 $ unfoldrM (\b r -> Just (r + b, b + 1)) (1 :: Int) 2'
expected: [3,4,5,6,7]
 but got: 
          ^
          <interactive>:313:10: error:
              Variable not in scope:
                unfoldrM :: (b0 -> b0 -> Maybe (b0, b0)) -> Int -> t0 -> [a]

src/Distribution/Utils/Generic.hs:503: failure in expression `unsnoc [1, 2, 3]'
expected: Just ([1,2],3)
 but got: 
          ^
          <interactive>:323:1: error:
              Variable not in scope: unsnoc :: [a0] -> t

src/Distribution/Utils/Generic.hs:518: failure in expression `unsnocNE (1 :| [2, 3])'
expected: ([1,2],3)
 but got: 
          ^
          <interactive>:333:1: error:
              Variable not in scope: unsnocNE :: t1 -> t
          
          <interactive>:333:13: error:
              Data constructor not in scope: (:|) :: t0 -> [a0] -> t1
              Suggested fix: Perhaps use variable ‘||’ (imported from Prelude)

src/Distribution/Utils/MD5.hs:30: failure in expression `showMD5 (Fingerprint 123 456)'
expected: "000000000000007b00000000000001c8"
 but got: 
          ^
          <interactive>:339:1: error:
              Variable not in scope: showMD5 :: t2 -> t
          
          <interactive>:339:10: error:
              Data constructor not in scope: Fingerprint :: t0 -> t1 -> t2

src/Distribution/Utils/MD5.hs:[64](https://github.com/haskell/cabal/actions/runs/6396526848/job/17362485036?pr=9306#step:9:65): failure in expression `showMD5 $ md5FromInteger 0x37eff01866ba3f538421b30b7cbefcac'
expected: "37eff01866ba3f538421b30b7cbefcac"
 but got: 
          ^
          <interactive>:345:1: error:
              Variable not in scope: showMD5 :: a0 -> b
          
          <interactive>:345:11: error:
              Variable not in scope: md5FromInteger :: t0 -> a0
              Suggested fix: Perhaps use ‘fromInteger’ (imported from Prelude)

src/Distribution/Compat/Newtype.hs:[68](https://github.com/haskell/cabal/actions/runs/6396526848/job/17362485036?pr=9306#step:9:69): failure in expression `ala Sum foldMap [1, 2, 3, 4 :: Int]'
expected: 10
 but got: 
          ^
          <interactive>:351:1: error:
              Variable not in scope:
                ala :: t0 -> ((a0 -> m0) -> t1 a0 -> m0) -> [Int] -> t
              Suggested fix: Perhaps use ‘all’ (imported from Prelude)
          
          <interactive>:351:5: error:
              Data constructor not in scope: Sum
              Suggested fix: Perhaps use variable ‘sum’ (imported from Prelude)

src/Distribution/Compat/Newtype.hs:80: failure in expression `alaf Sum foldMap length ["cabal", "install"]'
expected: 12
 but got: 
          ^
          <interactive>:357:1: error:
              Variable not in scope:
                alaf
                  :: t0 -> ((a0 -> m0) -> t1 a0 -> m0) -> (t2 a1 -> Int) -> [a2] -> t
          
          <interactive>:357:6: error:
              Data constructor not in scope: Sum
              Suggested fix: Perhaps use variable ‘sum’ (imported from Prelude)

Examples: [136](https://github.com/haskell/cabal/actions/runs/6396526848/job/17362485036?pr=9306#step:9:137)  Tried: 49  Errors: 0  Failures: 42
Error: cabal: repl failed for Cabal-syntax-3.11.0.0
@ulysses4ever
Copy link
Collaborator

One observation is that the

    Optimization flags conflict with --interactive; optimization flags ignored.

has appeared before but didn't seem to hurt.

It almost looks like GHC < 9.4 interpreted -Werror -w left-to-right and GHC 9.4 does right to left but this, of course, doesn't seem to be the case (from what I can see on simple examples).

Needs more thought...

@geekosaur
Copy link
Collaborator Author

ghc-9.4 -Werror -w -O does elicit the same failure. ghc-9.4 -Werror -Wwarn -O does not.

I feel like -w used to work but is no longer supported or does something different now?

@ulysses4ever
Copy link
Collaborator

ulysses4ever commented Oct 4, 2023

Could you try with 9.2?

My experiment was as follows:

cat main.hs
main = print 42ghc-9.4.4 -fforce-recomp -Wall -Werror -w main.hs
[1 of 2] Compiling Main             ( main.hs, main.o )
[2 of 2] Linking main [Objects changed]ghc-9.2.7 -fforce-recomp -Wall -Werror -w main.hs
[1 of 1] Compiling Main             ( main.hs, main.o )
Linking main ...ghc-9.4.4 -fforce-recomp -w -Wall -Werror main.hs
[1 of 2] Compiling Main             ( main.hs, main.o )

main.hs:1:1: error: [-Wmissing-signatures, -Werror=missing-signatures]
    Top-level binding with no type signature: main :: IO ()
  |
1 | main = print 42
  | ^^^^

main.hs:1:8: error: [-Wtype-defaults, -Werror=type-defaults]
    • Defaulting the type variable ‘a0’ to type ‘Integer’ in the following constraints
        (Show a0) arising from a use of ‘print’ at main.hs:1:8-12
        (Num a0) arising from the literal ‘42’ at main.hs:1:14-15
    • In the expression: print 42
      In an equation for ‘main’: main = print 42
  |
1 | main = print 42
  |        ^^^^^ghc-9.2.7 -fforce-recomp -w -Wall -Werror main.hs
[1 of 1] Compiling Main             ( main.hs, main.o )

main.hs:1:1: error: [-Wmissing-signatures, -Werror=missing-signatures]
    Top-level binding with no type signature: main :: IO ()
  |
1 | main = print 42
  | ^^^^

main.hs:1:8: error: [-Wtype-defaults, -Werror=type-defaults]
    • Defaulting the following constraints to type ‘Integer’
        (Show a0) arising from a use of ‘print’ at main.hs:1:8-12
        (Num a0) arising from the literal ‘42’ at main.hs:1:14-15
    • In the expression: print 42
      In an equation for ‘main’: main = print 42
  |
1 | main = print 42
  |        ^^^^^

So, I don't see a difference between 9.2 and 9.4. Perhaps it's too simple of an example.

@geekosaur
Copy link
Collaborator Author

I'm not seeing a difference here. My test was based on ghci and in fact the specific error being raised…

skkukuk «xmonad:skkukuk» ⁅xmonad-bsa⁆ Z$ ghci-9.2 -Werror -w -O       

when making flags consistent: error: [-Werror]
    -O conflicts with --interactive; -O ignored.
zsh: exit 1     ghci-9.2 -Werror -w -O
skkukuk «xmonad:skkukuk» ⁅xmonad-bsa⁆ Z$ ghci-9.2 -Werror -Wwarn -O

when making flags consistent: warning:
    -O conflicts with --interactive; -O ignored.
GHCi, version 9.2.8: https://www.haskell.org/ghc/  :? for help
ghci> 

And with 9.4:

skkukuk «xmonad:skkukuk» ⁅xmonad-bsa⁆ Z$ ghci-9.4 -Werror -w -O

when making flags consistent: error: [-Werror]
    Optimization flags conflict with --interactive; optimization flags ignored.
zsh: exit 1     ghci-9.4 -Werror -w -O
skkukuk «xmonad:skkukuk» ⁅xmonad-bsa⁆ Z$ ghci-9.4 -Werror -Wwarn -O    

when making flags consistent: warning:
    Optimization flags conflict with --interactive; optimization flags ignored.
GHCi, version 9.4.7: https://www.haskell.org/ghc/  :? for help
ghci> 

The precise error message changes though; I don't know if that could be relevant.

@geekosaur
Copy link
Collaborator Author

Either way it looks like -Wwarn instead of -w might be the way to go.

@ulysses4ever
Copy link
Collaborator

That -Werror is silly: it comes from cabal.project.validate but doctest doesn't need it. I was just lazy and wanted to avoid creating another project file. I think we just bite the bullet and create one for doctests, where we don't put that -Werror.

I tried that locally and it seemed to have moved further but it still reports 3 not-in-scope errors for Cabal-syntax somehow.

@andreabedini
Copy link
Collaborator

andreabedini commented Oct 4, 2023

I am also reaching the same conclusions but it looks like there are multiple elements at play, mostly caused by differences in cabal.project and cabal.project.validate and changes between ghc-9.2 and ghc-9.4.

@andreabedini
Copy link
Collaborator

The plan generated by cabal.project.validate has text-2.0.2 with ghc-9.4.7 and text-1.2.5.0 with ghc-9.2.8. This difference is not present with cabal.project which has constraints: text >= 2.0.

(index-state: 2023-10-03T04:02:05Z)

@andreabedini
Copy link
Collaborator

I get the warnings turning into errors but I cannot figure out how this can happen ...

src/Distribution/InstalledPackageInfo.hs:133: failure in expression `let ipi = emptyInstalledPackageInfo { maintainer = "Tester" }'
expected:
 but got:
          ^
          <interactive>:35:39: error: Not in scope: ‘maintainer’

@andreabedini
Copy link
Collaborator

5 hours later ...

That happens because the module does not load because of a type error and doctest is hiding the message. When doctest says

### Started execution at src/Distribution/InstalledPackageInfo.hs:133.
### example:
let ipi = emptyInstalledPackageInfo { maintainer = "Tester" }
src/Distribution/InstalledPackageInfo.hs:133: failure in expression `let ipi = emptyInstalledPackageInfo { maintainer = "Tester" }'
expected:
 but got:
          ^
          <interactive>:35:39: error: Not in scope: 'maintainer'

what happens is actually this (Out: is doctest writing, In: is ghci replying)

Out: :m *Distribution.InstalledPackageInfo
Out: :set -XOverloadedStrings
Out: :reload
In:
In: when making flags consistent: warning:
In:     Optimization flags conflict with --interactive; optimization flags ignored.
In:
In: src/Distribution/Types/ComponentId.hs:69:38: error:
In:     • Could not deduce (Foldable t0) arising from a use of 'elem'
In:       from the context: CabalParsing m
In:         bound by the type signature for:
In:                    parsec :: forall (m :: * -> *). CabalParsing m => m ComponentId
In:         at src/Distribution/Types/ComponentId.hs:67:3-8
<!--- snip --->
Out: :m *Distribution.InstalledPackageInfo
In:
In: <no location info>: error:
In:     Could not load module 'Distribution.InstalledPackageInfo'
In:     It is a member of the hidden package 'Cabal-syntax-3.8.1.0'.
In:     Perhaps you need to add 'Cabal-syntax' to the build-depends in your .cabal file.
In:     It is a member of the hidden package 'Cabal-syntax-3.10.1.0'.
In:     Perhaps you need to add 'Cabal-syntax' to the build-depends in your .cabal file.
In:     It is a member of the hidden package 'Cabal-syntax-3.10.1.0'.
In:     Perhaps you need to add 'Cabal-syntax' to the build-depends in your .cabal file.
In:     It is a member of the hidden package 'Cabal-syntax-3.10.1.0'.
In:     Perhaps you need to add 'Cabal-syntax' to the build-depends in your .cabal file.
Out: :set -XOverloadedStrings
Out: let ipi = emptyInstalledPackageInfo { maintainer = "Tester" }
In:
In: <interactive>:35:39: error: Not in scope: 'maintainer'

Given this only happens with doctest, I am thinking that it's OverloadedStrings interacting badly with a change in GHC type inference.

@andreabedini
Copy link
Collaborator

I tried to fix this in dc08acb. Let's see if it works.

@ulysses4ever ulysses4ever added cabal-testsuite re: doctest Concerning doctest suites and removed needs triage labels Oct 4, 2023
@ulysses4ever
Copy link
Collaborator

@andreabedini close. Could you create a copy of the project file, remove -Werror and point the doctest make rule to it? I think that should fix the rest of errors.

@ulysses4ever
Copy link
Collaborator

@andreabedini I checked this idea and it worked. That's when applied on top of your branch, because you fixed several actual issues in the code. Do you want me to push my part in your branch?

ulysses4ever added a commit that referenced this issue Oct 5, 2023
This became necessary after an upgrade to GHC 9.4, which, apparently,
has a subtle change in how -W/-w-related things get interpreted.
mergify bot pushed a commit that referenced this issue Oct 5, 2023
This became necessary after an upgrade to GHC 9.4, which, apparently,
has a subtle change in how -W/-w-related things get interpreted.

(cherry picked from commit ccce7c3)
Mikolaj pushed a commit that referenced this issue Oct 5, 2023
* Bump base in cabal-dev-scripts.cabal

Bump base in cabal-dev-scripts.cabal. We are now using GHC 9.4.7 in CI, which ships with base 4.17.2.0. I am bumping all the way to <4.19 after testing everything compiles with GHC 9.6.3 (base-4.18.1.0).

(cherry picked from commit 033e8e0)

* Avoid OverloadedStrings when it causes troubles

(cherry picked from commit dc08acb)

# Conflicts:
#	Cabal-syntax/src/Distribution/Fields/Parser.hs

* doctest: provide a separate project file without -Werror (fix #9307)

This became necessary after an upgrade to GHC 9.4, which, apparently,
has a subtle change in how -W/-w-related things get interpreted.

(cherry picked from commit ccce7c3)

* fixup! resolve a conflict

---------

Co-authored-by: Andrea Bedini <andrea.bedini@tweag.io>
Co-authored-by: Artem Pelenitsyn <a.pelenitsyn@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants