How do I make sure to use the newest version of Ocaml?

I did opam upgrade but I am still using an old version of ocaml. Why?

What’s the output of opam switch list, it’s likely you specified a precise version to use, and thus you can upgrade it from opam switch ... as normal. opam help switch for help.

You can also run opam upgrade --unlock-base to upgrade all the packages of the current switch including the compiler.
(by default opam will not change the version of the compiler you are using; the --unlock-base option tells it to lift that restriction)