diff --git a/lib/src/solver/package_lister.dart b/lib/src/solver/package_lister.dart index 0ee7a9224..8b5dc7d7f 100644 --- a/lib/src/solver/package_lister.dart +++ b/lib/src/solver/package_lister.dart @@ -227,6 +227,7 @@ class PackageLister { return incompatibilities; } else { return pubspec.dependencies.values + .where((range) => !_overriddenPackages.contains(range.name)) .map((range) => _dependency(depender, range)) .toList(); } diff --git a/test/version_solver_test.dart b/test/version_solver_test.dart index 30be6daa5..923d39dec 100644 --- a/test/version_solver_test.dart +++ b/test/version_solver_test.dart @@ -1797,6 +1797,31 @@ void override() { await expectResolves(result: {'foo': '0.0.0'}); }); + + // Regression test for #1853 + test("overrides a locked package's dependency", () async { + await servePackages((builder) { + builder.serve("foo", "1.2.3", deps: {"bar": "1.2.3"}); + builder.serve("bar", "1.2.3"); + builder.serve("bar", "0.0.1"); + }); + + await d.appDir({"foo": "any"}).create(); + + await expectResolves(result: {'foo': '1.2.3', 'bar': '1.2.3'}); + + await d.dir(appPath, [ + d.pubspec({ + "name": "myapp", + "dependencies": {"foo": "any"}, + "dependency_overrides": { + "bar": '0.0.1' + } + }) + ]).create(); + + await expectResolves(result: {'foo': '1.2.3', 'bar': '0.0.1'}); + }); } void downgrade() {