E0034

E0034#

Warning name: implicit_use_builtin

Implicit use of definitions from moonbitlang/core/builtin.

This warning is emitted when code implicitly relies on definitions from moonbitlang/core/builtin. Consider importing the desired APIs explicitly to make dependencies clearer.

Erroneous example#

Here Null is inferred as the Json::Null constructor from moonbitlang/core/builtin without an explicit type or qualification:

///|
pub fn check(value : Json) -> Int {
  fn classify(input) {
    match input {
      Null => 0
      _ => 1
    }
  }

  classify(value)
}

Suggestion#

Make the builtin dependency explicit and qualify the constructor, or otherwise add enough type information that the code no longer relies on implicit builtin constructor inference.

///|
pub fn check(value : Json) -> Int {
  fn classify(input : Json) {
    match input {
      Json::Null => 0
      _ => 1
    }
  }

  classify(value)
}