From e4183d60d4912ba9303ec82e7784b8c34fb6ef71 Mon Sep 17 00:00:00 2001 From: Mathias Lang Date: Thu, 4 Jan 2024 11:21:46 +0100 Subject: [PATCH] Make PackageManager.load non-const It was made const to satisfy PackageManager.addPackages, but that method actually takes a field of the PackageManager as ref parameter, so it can never be called from a 'const' context, and while implementing 'TestPackageManager.load', it was found that 'const' wasn't suitable. --- source/dub/packagemanager.d | 4 ++-- source/dub/test/base.d | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/source/dub/packagemanager.d b/source/dub/packagemanager.d index 7506acc84..5eadc3052 100644 --- a/source/dub/packagemanager.d +++ b/source/dub/packagemanager.d @@ -364,7 +364,7 @@ class PackageManager { */ protected Package load(NativePath path, NativePath recipe = NativePath.init, Package parent = null, string version_ = null, - StrictMode mode = StrictMode.Ignore) const + StrictMode mode = StrictMode.Ignore) { if (recipe.empty) recipe = Package.findPackageFile(path); @@ -1023,7 +1023,7 @@ symlink_exit: /// Adds the package and scans for sub-packages. private void addPackages(ref Package[] dst_repos, Package pack) - const { + { // Add the main package. dst_repos ~= pack; diff --git a/source/dub/test/base.d b/source/dub/test/base.d index 695ac16b3..3c78e4a2e 100644 --- a/source/dub/test/base.d +++ b/source/dub/test/base.d @@ -291,7 +291,7 @@ package class TestPackageManager : PackageManager */ protected override Package load(NativePath path, NativePath recipe = NativePath.init, Package parent = null, string version_ = null, - StrictMode mode = StrictMode.Ignore) const + StrictMode mode = StrictMode.Ignore) { assert(0, "`TestPackageManager.load` is not implemented"); }