Array.sort undefined in 0.7.0

I wanted to the entries of an array but I get the following error :
type error [M0072], field sort does not exist in type

I’m importing it with :
import Array "mo:base/Array";

I tried with vessel to add the dependency like this :

  -- This is where you can add your own packages to the package-set
  additions =
    name = "base",
    repo = "",
    version = "dfx-0.7.0",
    dependencies = ["base"]
  }] : List Package

In the sources I see that there is no sortmethod in the file.
I tried with version master but it can’t compile because of Prim see Use import Prim "mo:⛔" · dfinity/[email protected] · GitHub

What am I missing :frowning: ?

Try using a specific commit hash in the version field:

name = "base",
repo = "",
version = "6162dc91daabf57c6432e9080d66cf90e074f806",
dependencies = ["base"]
.vessel/base/6162dc91daabf57c6432e9080d66cf90e074f806/src/ type error [M0028], field Types does not exist in type

I get this error because of Prim which is undefined. Use import Prim “mo::no_entry:” · dfinity/[email protected] · GitHub

Is your project using import Prim “mo:Prim”; anywhere?

I think the compiler version used here might be “old”. I think you need to be using dfx 0.7.0, to have the new Prim name work.


dfx --version
dfx 0.7.0

@Ori it’s imported in motoko-base ine multiple files like

Did you maybe lock down the dfx version in the project itself? dfx.json has a field called "dfx" that lets you set that.

Yes I did :

  "dfx": "0.7.0",

In that case you might need to wait for the next dfx release before you access Array.sort from base, sorry. Until then you could just copy the definition into your project as it doesn’t rely on any unreleased features, and replace it with the base version later.

Alright, I’m using examples/ at master · dfinity/examples · GitHub for the moment.
Wanted to clean the codebase but I will do it later. I was wondering if I was doing something wrong.
Have a good day,