Skip to content

Commit

Permalink
Support varargs (improve test, show code breaking)
Browse files Browse the repository at this point in the history
  • Loading branch information
jevanlingen committed Dec 27, 2024
1 parent 26d2d2c commit b0fcbbc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,7 @@ public void visitMethod(MethodNode method) {
paramType = visitTypeTree(param.getOriginType());
}

// TODO: propably better implementation, the `paramType` does not handle well when varargs + index operator is used
Space varargs = null;
if (paramType instanceof J.ArrayType) {
// E.g. foo(String... x)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ void varargsArguments() {
groovy(
"""
def foo(String... messages) {
println(messages[0])
}
"""
)
Expand Down

0 comments on commit b0fcbbc

Please sign in to comment.