Skip to content
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

added handling for default parameters #326

Merged
merged 4 commits into from
Jul 24, 2024
Merged

added handling for default parameters #326

merged 4 commits into from
Jul 24, 2024

Conversation

lbialy
Copy link
Contributor

@lbialy lbialy commented Jul 21, 2024

had to go from dumb mirrors to a full blown macro for products but hey, mirrors do not expose default params

closes #215

@lbialy lbialy requested review from tgodzik and prolativ July 21, 2024 11:23
fail(s"failed with YamlError: $error")
case Right(foo) =>
assertEquals(foo.a, 1)
assertEquals(foo.b, "test-3")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about one more case with b specified to assert that the default is not invoked (so times is not incremented) when an argument is given explicitly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


'{ $namesExpr.zip($identsExpr).toMap }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if the order of declarations in body is reliable. Maybe it would be better to use something like sym.companionClass.methodMember("$lessinit$greater$default$" + n.toString).head to get the default value provider method for the n-th field?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, agreed

@lbialy lbialy merged commit 5bf61d1 into main Jul 24, 2024
6 checks passed
@lbialy lbialy deleted the issue-215 branch July 24, 2024 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use default arguments when field is not provided
2 participants