diff --git a/Cabal/tests/ParserTests.hs b/Cabal/tests/ParserTests.hs
index e93108137d772ab8e1a2a0592b0a0d2416069253..0a5e9ca4515b55d2483afa47ab20d009d17e905c 100644
--- a/Cabal/tests/ParserTests.hs
+++ b/Cabal/tests/ParserTests.hs
@@ -181,6 +181,7 @@ regressionTests = testGroup "regressions"
     , regressionTest "indentation.cabal"
     , regressionTest "indentation2.cabal"
     , regressionTest "indentation3.cabal"
+    , regressionTest "issue6083-pkg-pkg.cabal"
     ]
 
 regressionTest :: FilePath -> TestTree
diff --git a/Cabal/tests/ParserTests/regressions/issue6083-pkg-pkg.cabal b/Cabal/tests/ParserTests/regressions/issue6083-pkg-pkg.cabal
new file mode 100644
index 0000000000000000000000000000000000000000..827834afc29b1d3e2a11f4f2853d6cb15bc35fc3
--- /dev/null
+++ b/Cabal/tests/ParserTests/regressions/issue6083-pkg-pkg.cabal
@@ -0,0 +1,9 @@
+cabal-version: 3.0
+name: issue
+version: 6083
+
+library
+  default-language: Haskell2010
+  -- This should be parsed as the main lib
+  build-depends: freetype
+  build-depends: freetype:freetype
diff --git a/Cabal/tests/ParserTests/regressions/issue6083-pkg-pkg.expr b/Cabal/tests/ParserTests/regressions/issue6083-pkg-pkg.expr
new file mode 100644
index 0000000000000000000000000000000000000000..9192103977f7ee556a6db08be890d34cdf128406
--- /dev/null
+++ b/Cabal/tests/ParserTests/regressions/issue6083-pkg-pkg.expr
@@ -0,0 +1,111 @@
+GenericPackageDescription
+  {condBenchmarks = [],
+   condExecutables = [],
+   condForeignLibs = [],
+   condLibrary = Just
+                   CondNode
+                     {condTreeComponents = [],
+                      condTreeConstraints = [Dependency
+                                               `PackageName "freetype"`
+                                               AnyVersion
+                                               (Set.fromList [LMainLibName]),
+                                             Dependency
+                                               `PackageName "freetype"`
+                                               AnyVersion
+                                               (Set.fromList [LMainLibName])],
+                      condTreeData = Library
+                                       {exposedModules = [],
+                                        libBuildInfo = BuildInfo
+                                                         {asmOptions = [],
+                                                          asmSources = [],
+                                                          autogenIncludes = [],
+                                                          autogenModules = [],
+                                                          buildToolDepends = [],
+                                                          buildTools = [],
+                                                          buildable = True,
+                                                          cSources = [],
+                                                          ccOptions = [],
+                                                          cmmOptions = [],
+                                                          cmmSources = [],
+                                                          cppOptions = [],
+                                                          customFieldsBI = [],
+                                                          cxxOptions = [],
+                                                          cxxSources = [],
+                                                          defaultExtensions = [],
+                                                          defaultLanguage = Just Haskell2010,
+                                                          extraBundledLibs = [],
+                                                          extraDynLibFlavours = [],
+                                                          extraFrameworkDirs = [],
+                                                          extraGHCiLibs = [],
+                                                          extraLibDirs = [],
+                                                          extraLibFlavours = [],
+                                                          extraLibs = [],
+                                                          frameworks = [],
+                                                          hsSourceDirs = [],
+                                                          includeDirs = [],
+                                                          includes = [],
+                                                          installIncludes = [],
+                                                          jsSources = [],
+                                                          ldOptions = [],
+                                                          mixins = [],
+                                                          oldExtensions = [],
+                                                          options = PerCompilerFlavor [] [],
+                                                          otherExtensions = [],
+                                                          otherLanguages = [],
+                                                          otherModules = [],
+                                                          pkgconfigDepends = [],
+                                                          profOptions = PerCompilerFlavor [] [],
+                                                          sharedOptions = PerCompilerFlavor [] [],
+                                                          staticOptions = PerCompilerFlavor [] [],
+                                                          targetBuildDepends = [Dependency
+                                                                                  `PackageName "freetype"`
+                                                                                  AnyVersion
+                                                                                  (Set.fromList
+                                                                                     [LMainLibName]),
+                                                                                Dependency
+                                                                                  `PackageName "freetype"`
+                                                                                  AnyVersion
+                                                                                  (Set.fromList
+                                                                                     [LMainLibName])],
+                                                          virtualModules = []},
+                                        libExposed = True,
+                                        libName = LMainLibName,
+                                        libVisibility = LibraryVisibilityPublic,
+                                        reexportedModules = [],
+                                        signatures = []}},
+   condSubLibraries = [],
+   condTestSuites = [],
+   genPackageFlags = [],
+   packageDescription = PackageDescription
+                          {author = "",
+                           benchmarks = [],
+                           bugReports = "",
+                           buildTypeRaw = Nothing,
+                           category = "",
+                           copyright = "",
+                           customFieldsPD = [],
+                           dataDir = "",
+                           dataFiles = [],
+                           description = "",
+                           executables = [],
+                           extraDocFiles = [],
+                           extraSrcFiles = [],
+                           extraTmpFiles = [],
+                           foreignLibs = [],
+                           homepage = "",
+                           library = Nothing,
+                           licenseFiles = [],
+                           licenseRaw = Left NONE,
+                           maintainer = "",
+                           package = PackageIdentifier
+                                       {pkgName = `PackageName "issue"`,
+                                        pkgVersion = `mkVersion [6083]`},
+                           pkgUrl = "",
+                           setupBuildInfo = Nothing,
+                           sourceRepos = [],
+                           specVersionRaw = Left `mkVersion [3,0]`,
+                           stability = "",
+                           subLibraries = [],
+                           synopsis = "",
+                           testSuites = [],
+                           testedWith = []}}
diff --git a/Cabal/tests/ParserTests/regressions/issue6083-pkg-pkg.format b/Cabal/tests/ParserTests/regressions/issue6083-pkg-pkg.format
new file mode 100644
index 0000000000000000000000000000000000000000..da7fecdf60a34260dcdaa182dfde38d577a7f2a9
--- /dev/null
+++ b/Cabal/tests/ParserTests/regressions/issue6083-pkg-pkg.format
@@ -0,0 +1,9 @@
+cabal-version: 3.0
+name:          issue
+version:       6083
+
+library
+    default-language: Haskell2010
+    build-depends:
+        freetype -any,
+        freetype -any