opam info package has a field available-versions, which lists all versions of a given package that are available for at least one OCaml version.
What is much more useful to me, in everyday usage, is the list of package versions that are available for my current OCaml version.
For instance, if I am currently on OCaml 4.05.0, and I run opam info merlin, I get:
available-versions: 1.3, 1.3.1, 1.3.1-trunk, 1.4, 1.4.1, 1.5, 1.6, 1.7,
1.7.1, 2.0.0, 2.1.0, 2.1.1, 2.1.2, 2.2, 2.3, 2.3.1, 2.5.0, 2.5.1, 2.5.2,
2.5.3, 2.5.4, 2.5.5, 3.0.0, 3.0.1, 3.0.2, 3.0.3
But if I try opam install merlin.1.3, it fails:
[ERROR] merlin.1.3 is not available because your system doesn't comply
with ocaml-version > "4.00.1" & ocaml-version < "4.02.0".
Note that opam list only outputs a single line (installed version, or -- if not installed), so it also does not allow knowing which versions are installable.
Is there a way to directly obtain all package versions that are actually available (for my current compiler), other than by trying to install each one of them?