Skip to content

Clarify that using val is given member #12312

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

Merged
merged 1 commit into from
May 27, 2021
Merged

Conversation

som-snytt
Copy link
Contributor

Fixes #10882


class GivenIntBox2(using givenInt: Int):
given Int = givenInt
//def n = summon[Int] // ambiguous
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the explanation! Maybe we can use given Int = 42 here? Otherwise one might argue that semantically there is no ambiguity -- only the compiler complains about it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Interesting point. My idea was that if you want to "export givenInt" as a given, you might try it this way.

@b-studios b-studios merged commit feabdf0 into scala:master May 27, 2021
@som-snytt som-snytt deleted the issue/10882 branch May 27, 2021 13:46
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.

Document using parameters on classes can provide given instances
2 participants