diff --git a/master_changes.md b/master_changes.md
index 64d2b77cc2e..b877daed335 100644
--- a/master_changes.md
+++ b/master_changes.md
@@ -39,6 +39,7 @@ users)
## Switch
* [BUG] Fix `opam switch remove
` failure when it is a linked switch [#6276 @btjorge - fix #6275]
+ * Fix `opam switch list-available` when given several arguments [#6318 @kit-ty-kate]
## Config
diff --git a/src/client/opamCommands.ml b/src/client/opamCommands.ml
index 1d1266926fe..83f15c3f1b4 100644
--- a/src/client/opamCommands.ml
+++ b/src/client/opamCommands.ml
@@ -2904,7 +2904,7 @@ let switch cli =
in
let all_compilers =
OpamListCommand.filter ~base:compilers st
- (OpamFormula.ands (List.map (fun f -> OpamFormula.Atom f) filters))
+ (OpamFormula.ors (List.map (fun f -> OpamFormula.Atom f) filters))
in
let compilers =
if all then
@@ -3199,7 +3199,7 @@ let pin_doc = "Pin a given package to a specific version or source."
let pin ?(unpin_only=false) cli =
let doc = pin_doc in
let commands = [
- cli_original, "list", `list, [],
+ cli_original, "list", `list, [],
"Lists pinned packages. \
If the source is a remote repository, \
displays the hash representing its state.";
diff --git a/tests/reftests/switch-list-available.test b/tests/reftests/switch-list-available.test
index bedc168df16..cd0860fe625 100644
--- a/tests/reftests/switch-list-available.test
+++ b/tests/reftests/switch-list-available.test
@@ -152,4 +152,12 @@ comp_c 2
### : show the behaviour of list-available with several arguments
### opam switch list-available "comp-*" "comp_*"
# Listing available compilers from repositories: default
-# No matches found
+# Name # Version # Synopsis
+comp-a 1
+comp-b 1
+comp_c 1
+comp-a 2
+comp-a 3
+comp-a 4
+comp-b 4
+[NOTE] Some compilers have been hidden (e.g. pre-releases). If you want to display them, run: 'opam switch list-available --all'