E4020

E4020#

Package not found in the loaded packages.

Erroneous Example#

pub let a : Int = @boolean.Bool::to_int(true)

The example above tries to call the method to_int in a package boolean, but this package is not present in the list of loaded packages, giving the following error on line 1:

Package "boolean" not found in the loaded packages.

Suggestion#

Make sure the package name is valid.

If it is not a package in module moonbitlang/core, make sure that it is mentioned as one of the imported packages in moon.pkg.json as well.

In the above example, call the method on Bool directly:

pub let a : Int = true.to_int()