diff --git a/Cabal/Cabal.cabal b/Cabal/Cabal.cabal index 94326400bfc..d97b2170814 100644 --- a/Cabal/Cabal.cabal +++ b/Cabal/Cabal.cabal @@ -44,6 +44,8 @@ extra-source-files: tests/ParserTests/errors/forward-compat2.errors tests/ParserTests/errors/forward-compat3.cabal tests/ParserTests/errors/forward-compat3.errors + tests/ParserTests/errors/issue-5055.cabal + tests/ParserTests/errors/issue-5055.errors tests/ParserTests/errors/leading-comma.cabal tests/ParserTests/errors/leading-comma.errors tests/ParserTests/errors/range-ge-wild.cabal @@ -82,6 +84,9 @@ extra-source-files: tests/ParserTests/regressions/generics-sop.expr tests/ParserTests/regressions/generics-sop.format tests/ParserTests/regressions/haddock-api-2.18.1-check.cabal + tests/ParserTests/regressions/issue-5055.cabal + tests/ParserTests/regressions/issue-5055.expr + tests/ParserTests/regressions/issue-5055.format tests/ParserTests/regressions/issue-774.cabal tests/ParserTests/regressions/issue-774.expr tests/ParserTests/regressions/issue-774.format diff --git a/Cabal/tests/ParserTests.hs b/Cabal/tests/ParserTests.hs index ebc18132604..c0e8232ad55 100644 --- a/Cabal/tests/ParserTests.hs +++ b/Cabal/tests/ParserTests.hs @@ -99,6 +99,7 @@ errorTests = testGroup "errors" , errorTest "forward-compat.cabal" , errorTest "forward-compat2.cabal" , errorTest "forward-compat3.cabal" + , errorTest "issue-5055.cabal" ] errorTest :: FilePath -> TestTree @@ -136,6 +137,7 @@ regressionTests = testGroup "regressions" , regressionTest "leading-comma.cabal" , regressionTest "wl-pprint-indef.cabal" , regressionTest "th-lift-instances.cabal" + , regressionTest "issue-5055.cabal" ] regressionTest :: FilePath -> TestTree diff --git a/Cabal/tests/ParserTests/errors/issue-5055.cabal b/Cabal/tests/ParserTests/errors/issue-5055.cabal new file mode 100644 index 00000000000..bc3cf65e144 --- /dev/null +++ b/Cabal/tests/ParserTests/errors/issue-5055.cabal @@ -0,0 +1,21 @@ +name: issue +version: 5055 +synopsis: no type in all branches +description: no type in all branches. +license: BSD3 +category: Test +build-type: Simple +cabal-version: >=2.0 + +executable flag-test-exe + main-is: FirstMain.hs + build-depends: base >= 4.8 && < 5 + default-language: Haskell2010 + +test-suite flag-cabal-test + build-depends: base >= 4.8 && < 5 + default-language: Haskell2010 + + if os(windows) + main-is: FirstMain.hs + type: exitcode-stdio-1.0 diff --git a/Cabal/tests/ParserTests/errors/issue-5055.errors b/Cabal/tests/ParserTests/errors/issue-5055.errors new file mode 100644 index 00000000000..5df7507e2de --- /dev/null +++ b/Cabal/tests/ParserTests/errors/issue-5055.errors @@ -0,0 +1 @@ +ERROR diff --git a/Cabal/tests/ParserTests/regressions/issue-5055.cabal b/Cabal/tests/ParserTests/regressions/issue-5055.cabal new file mode 100644 index 00000000000..6cc422d1a24 --- /dev/null +++ b/Cabal/tests/ParserTests/regressions/issue-5055.cabal @@ -0,0 +1,23 @@ +name: issue +version: 5055 +synopsis: no type in all branches +description: no type in all branches. +license: BSD3 +category: Test +build-type: Simple +cabal-version: >=2.0 + +executable flag-test-exe + main-is: FirstMain.hs + build-depends: base >= 4.8 && < 5 + default-language: Haskell2010 + +test-suite flag-cabal-test + type: exitcode-stdio-1.0 + build-depends: base >= 4.8 && < 5 + default-language: Haskell2010 + + if os(windows) + main-is: FirstMain.hs + else: + main-is: SecondMain.hs diff --git a/Cabal/tests/ParserTests/regressions/issue-5055.expr b/Cabal/tests/ParserTests/regressions/issue-5055.expr new file mode 100644 index 00000000000..a063a2ea033 --- /dev/null +++ b/Cabal/tests/ParserTests/regressions/issue-5055.expr @@ -0,0 +1,214 @@ +GenericPackageDescription + {condBenchmarks = [], + condExecutables = [_×_ + `UnqualComponentName "flag-test-exe"` + CondNode + {condTreeComponents = [], + condTreeConstraints = [Dependency + `PackageName "base"` + (IntersectVersionRanges + (OrLaterVersion `mkVersion [4,8]`) + (EarlierVersion `mkVersion [5]`))], + condTreeData = Executable + {buildInfo = BuildInfo + {asmOptions = [], + asmSources = [], + autogenModules = [], + buildToolDepends = [], + buildTools = [], + buildable = True, + cSources = [], + ccOptions = [], + cmmOptions = [], + cmmSources = [], + cppOptions = [], + customFieldsBI = [], + cxxOptions = [], + cxxSources = [], + defaultExtensions = [], + defaultLanguage = Just Haskell2010, + extraBundledLibs = [], + extraFrameworkDirs = [], + extraGHCiLibs = [], + extraLibDirs = [], + extraLibFlavours = [], + extraLibs = [], + frameworks = [], + hsSourceDirs = [], + includeDirs = [], + includes = [], + installIncludes = [], + jsSources = [], + ldOptions = [], + mixins = [], + oldExtensions = [], + options = [], + otherExtensions = [], + otherLanguages = [], + otherModules = [], + pkgconfigDepends = [], + profOptions = [], + sharedOptions = [], + staticOptions = [], + targetBuildDepends = [Dependency + `PackageName "base"` + (IntersectVersionRanges + (OrLaterVersion + `mkVersion [4,8]`) + (EarlierVersion + `mkVersion [5]`))], + virtualModules = []}, + exeName = `UnqualComponentName "flag-test-exe"`, + exeScope = ExecutableScopeUnknown, + modulePath = "FirstMain.hs"}}], + condForeignLibs = [], + condLibrary = Nothing, + condSubLibraries = [], + condTestSuites = [_×_ + `UnqualComponentName "flag-cabal-test"` + CondNode + {condTreeComponents = [CondBranch + {condBranchCondition = `Var (OS Windows)`, + condBranchIfFalse = Nothing, + condBranchIfTrue = CondNode + {condTreeComponents = [], + condTreeConstraints = [], + condTreeData = TestSuite + {testBuildInfo = BuildInfo + {asmOptions = [], + asmSources = [], + autogenModules = [], + buildToolDepends = [], + buildTools = [], + buildable = True, + cSources = [], + ccOptions = [], + cmmOptions = [], + cmmSources = [], + cppOptions = [], + customFieldsBI = [], + cxxOptions = [], + cxxSources = [], + defaultExtensions = [], + defaultLanguage = Nothing, + extraBundledLibs = [], + extraFrameworkDirs = [], + extraGHCiLibs = [], + extraLibDirs = [], + extraLibFlavours = [], + extraLibs = [], + frameworks = [], + hsSourceDirs = [], + includeDirs = [], + includes = [], + installIncludes = [], + jsSources = [], + ldOptions = [], + mixins = [], + oldExtensions = [], + options = [], + otherExtensions = [], + otherLanguages = [], + otherModules = [], + pkgconfigDepends = [], + profOptions = [], + sharedOptions = [], + staticOptions = [], + targetBuildDepends = [], + virtualModules = []}, + testInterface = TestSuiteExeV10 + `mkVersion [1,0]` + "FirstMain.hs", + testName = `UnqualComponentName ""`}}}], + condTreeConstraints = [Dependency + `PackageName "base"` + (IntersectVersionRanges + (OrLaterVersion `mkVersion [4,8]`) + (EarlierVersion `mkVersion [5]`))], + condTreeData = TestSuite + {testBuildInfo = BuildInfo + {asmOptions = [], + asmSources = [], + autogenModules = [], + buildToolDepends = [], + buildTools = [], + buildable = True, + cSources = [], + ccOptions = [], + cmmOptions = [], + cmmSources = [], + cppOptions = [], + customFieldsBI = [], + cxxOptions = [], + cxxSources = [], + defaultExtensions = [], + defaultLanguage = Just Haskell2010, + extraBundledLibs = [], + extraFrameworkDirs = [], + extraGHCiLibs = [], + extraLibDirs = [], + extraLibFlavours = [], + extraLibs = [], + frameworks = [], + hsSourceDirs = [], + includeDirs = [], + includes = [], + installIncludes = [], + jsSources = [], + ldOptions = [], + mixins = [], + oldExtensions = [], + options = [], + otherExtensions = [], + otherLanguages = [], + otherModules = [], + pkgconfigDepends = [], + profOptions = [], + sharedOptions = [], + staticOptions = [], + targetBuildDepends = [Dependency + `PackageName "base"` + (IntersectVersionRanges + (OrLaterVersion + `mkVersion [4,8]`) + (EarlierVersion + `mkVersion [5]`))], + virtualModules = []}, + testInterface = TestSuiteUnsupported + (TestTypeUnknown "" `mkVersion []`), + testName = `UnqualComponentName ""`}}], + genPackageFlags = [], + packageDescription = PackageDescription + {author = "", + benchmarks = [], + bugReports = "", + buildDepends = [], + buildTypeRaw = Just Simple, + category = "Test", + copyright = "", + customFieldsPD = [], + dataDir = "", + dataFiles = [], + description = "no type in all branches.", + executables = [], + extraDocFiles = [], + extraSrcFiles = [], + extraTmpFiles = [], + foreignLibs = [], + homepage = "", + library = Nothing, + licenseFiles = [], + licenseRaw = Right BSD3, + maintainer = "", + package = PackageIdentifier + {pkgName = `PackageName "issue"`, + pkgVersion = `mkVersion [5055]`}, + pkgUrl = "", + setupBuildInfo = Nothing, + sourceRepos = [], + specVersionRaw = Right (OrLaterVersion `mkVersion [2,0]`), + stability = "", + subLibraries = [], + synopsis = "no type in all branches", + testSuites = [], + testedWith = []}} diff --git a/Cabal/tests/ParserTests/regressions/issue-5055.format b/Cabal/tests/ParserTests/regressions/issue-5055.format new file mode 100644 index 00000000000..1cf3d27fa62 --- /dev/null +++ b/Cabal/tests/ParserTests/regressions/issue-5055.format @@ -0,0 +1,25 @@ +cabal-version: >=2.0 +name: issue +version: 5055 +license: BSD3 +synopsis: no type in all branches +description: + no type in all branches. +category: Test +build-type: Simple + +executable flag-test-exe + main-is: FirstMain.hs + scope: unknown + default-language: Haskell2010 + build-depends: + base >=4.8 && <5 + +test-suite flag-cabal-test + default-language: Haskell2010 + build-depends: + base >=4.8 && <5 + + if os(windows) + type: exitcode-stdio-1.0 + main-is: FirstMain.hs