Tweaked one_defined to give a better message when nothing was defined

This commit is contained in:
Adrian Mariano 2020-05-21 16:49:06 -04:00
parent 0256f582e5
commit 777facc9a2

View file

@ -177,7 +177,7 @@ function one_defined(vars, names, required=true) =
let (
ok = num_defined(vars)==1 || (!required && num_defined(vars)==0)
)
assert(ok,str("Must define ",required?"exactly":"at most"," one of ",[for(i=[0:len(vars)]) if (is_def(vars[i])) names[i]]))
assert(ok,str("Must define ",required?"exactly":"at most"," one of ",num_defined(vars)==0?names:[for(i=[0:len(vars)]) if (is_def(vars[i])) names[i]]))
first_defined(vars);