-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue with methods of multiple param lists where one is vargs #63
Comments
Interesting, I'm assuming the issue is because Scala3Mock actually flatten all parameter lists into one under the hood (the Not entirely sure if I'll have time to look at it this week, I should have some time over the weekend though. |
I looked into some more today. Unfortunately I'm not entirely sure how to go around that one. The mocking portion is relatively easy, we can introspect the method definition and if it's a vararg have special treatment for it (maybe converting it to a Seq). Where it become more complex is in the What is actually causing issue here is not the repeated parameters, it's the multiple parameter lists (we have the same issue if the repeated parameters are in the second parameter list). Because when using multiple parameter list, we have to build an anonymous function. Something like the following test: when(m.curried(_: Int)(_: Double)).expects(1, 2.1).returns("ok") But Scala doesn't have a way to do so with repeated parameters, so the following is not valid Scala when(m.curried(_: Int*)(_: Double)).expects(1, 2.1).returns("ok") So now we have a weird problem. How do we let scala3mock knows that the individually passed are actually part of a repeated parameters? Here we can't really cheat like we do for non-curried functions (where the So I'm a bit in a bind and am not entirely sure how to move forward on that issue unfortunately. |
Additions to investigation:
compiles and works, in an interesting way if I do the same in scalamock3's
then I found out that compilation fails only when repeated param stays in the first place:
|
Hello again @fmonniot, I've bumped into another issue trying to mock such service:
compile output with debug:
What might be potentially interesting for investigation is that such service:
compiles fine:
The text was updated successfully, but these errors were encountered: