E0082

E0082#

Warning name: ambiguous_braces

An empty {} literal is ambiguous among an empty map, JSON object, record, and block expression.

Erroneous example#

///|
pub fn empty_scores() -> Map[String, Int] {
  {}
}

Suggestion#

Write the intended constructor explicitly. For an empty map, use Map([]). Other alternatives include Json::empty_object(), TypeName::{}, and { () }.

///|
pub fn empty_scores() -> Map[String, Int] {
  Map([])
}