bail! when #symbol is called without parameters (#440)
This commit is contained in:
parent
f04b6ebc1a
commit
2ed4212c76
@ -258,6 +258,9 @@ pub fn symbol(
|
||||
variants: Vec<Spanned<Variant>>,
|
||||
) -> Value {
|
||||
let mut list = Vec::new();
|
||||
if variants.is_empty() {
|
||||
bail!(args.span, "expected at least one variant");
|
||||
}
|
||||
for Spanned { v, span } in variants {
|
||||
if list.iter().any(|(prev, _)| &v.0 == prev) {
|
||||
bail!(span, "duplicate variant");
|
||||
|
@ -57,6 +57,10 @@
|
||||
#envelope.lightning
|
||||
#envelope.fly
|
||||
|
||||
---
|
||||
// Error: 8-10 expected at least one variant
|
||||
#symbol()
|
||||
|
||||
---
|
||||
// Test conversion to string.
|
||||
#test(str(123), "123")
|
||||
|
Loading…
x
Reference in New Issue
Block a user