Skip to content

Commit

Permalink
Parse array access prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
knutwannheden committed Nov 9, 2023
1 parent 21be273 commit 82e155c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ public J visitArrayAccessExpression(KtArrayAccessExpression expression, Executio
JContainer<Expression> args = JContainer.build(Space.EMPTY, expressions, markers);
return new J.MethodInvocation(
randomId(),
Space.EMPTY,
prefix(expression),
markers,
select,
null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
package org.openrewrite.kotlin.tree;

import org.junit.jupiter.api.Test;
import org.junitpioneer.jupiter.ExpectedToFail;
import org.openrewrite.Issue;
import org.openrewrite.java.tree.J;
import org.openrewrite.kotlin.marker.IndexedAccess;
Expand Down Expand Up @@ -694,4 +693,22 @@ fun method() {
)
);
}

@Test
void namedParameters() {
rewriteRun(
kotlin(
"""
class Test {
fun foo(s: String) = s
fun bar(ss: Array<String>) {
foo(
s = ss[0]
)
}
}
"""
)
);
}
}

0 comments on commit 82e155c

Please sign in to comment.