Closed jurgenvinju closed 4 years ago
in CollectionExpression, line 713, it says arity >= size(formals) - 1
and I don't understand why it is not arity == size(formals) - 1
; could this be the cause of the issue?
The reported error is triggered in salix::demo::ide::IDE
.
Here is an initial assessment of the salix
library:
37 files, 13 with a problem, 1 crashed, 0 skipped
With errors: ["salix::Patch","salix::SVG","salix::demo::basic::Readme","salix::demo::graphs::DagreDemo","salix::demo::ide::LiveQL","salix::demo::ide::Richtext","salix::demo::shop::Shop","salix::demo::treeview::TreeViewDemo","salix::lib::Debug","salix::lib::Highlight","salix::lib::UML","salix::lib::XTerm","salix::tests::EventDiscarding"]
Crashed: ("salix::demo::ide::IDE":IndexOutOfBounds(2))
The test arity >= size(formals) - 1
describes the case of varargs:
arity
is the number of actual parameters in the call.size(formals) -1
represents the number of formal parameters without the last variadic formal parameter.The number of variadic actual parameters can be >= 0.
Therefore arity >= size(formals) - 1
covers all cases that there are 0, 1, ..., variadic actual parameters.
The problem was caused by overloaded functions where each overload has different arity and a varargs argument. I have added a check for this.
Type checking the whole of salix
is now enabled.
Cool! I'll see if I can remove the type errors from the rest of Salix in the coming period.
Describe the bug
Will have to simplify this case later; registering now for future reference.
BTW, this error message was produced with the rascal-maven-plugin-0.2.14 which prints the Rascal stack trace for the checker in such a case.
To Reproduce