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() -> Unit {
let scores = {}
scores.set("alice", 1)
}
Suggestion#
Write the intended constructor explicitly. For an empty map, use Map([]).
Other alternatives include Json::empty_object(), TypeName::{}, and { () }.
///|
pub fn empty_scores() -> Unit {
let scores : Map[String, Int] = Map([])
scores.set("alice", 1)
}