Error message for pattern singleton with args
@@ -2314,8 +2314,11 @@ Please report this to https://github.com/lpil/gleam/issues"
constructor,
})
} else {
- // Error: singleton given args
- unimplemented!()
+ Err(Error::IncorrectArity {
+ meta,
+ expected: 0,
+ given: pattern_args.len(),
+ })
}
}
@@ -3400,6 +3403,14 @@ fn infer_error_test() {
meta: Meta { start: 19, end: 20 },
},
},
+ Case {
+ src: "let True(x) = 1 x",
+ error: Error::IncorrectArity {
+ meta: Meta { start: 4, end: 11 },
+ expected: 0,
+ given: 1,
+ },
+ },
// TODO: remove when struct field access is supported
Case {
src: "let x = 1 x.whatever",
