Skip to content

fix #11897: error on given pattern in val def #12631

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
Jun 3, 2021

Conversation

bishabosha
Copy link
Member

@bishabosha bishabosha commented May 27, 2021

fixes #11897
fixes #12629

@smarter
Copy link
Member

smarter commented May 27, 2021

I'm not familiar with this code, could you describe in the commit message what it did previously and what it does differently now?

@odersky odersky self-requested a review May 28, 2021 09:56
@bishabosha
Copy link
Member Author

bishabosha commented May 28, 2021

This change will break source compatibility as now given pattern defs will shadow other givens in scope - so I imagine this should require some language import?

Edit (31/05/2021) - This change will break source compatibility as now given pattern in val defs will cause errors - so I imagine this should require some language import?

@bishabosha bishabosha marked this pull request as draft May 28, 2021 17:39
@bishabosha
Copy link
Member Author

bishabosha commented May 28, 2021

it seems val given Int = 1 has the same tree as given Int = 1, causing an error unexpectedly, so will need to go back to drawing board on that, or just drop the change.

Edit - not applicable

@smarter
Copy link
Member

smarter commented May 29, 2021

This change will break source compatibility as now given pattern defs will shadow other givens in scope - so I imagine this should require some language import?

Source-breaking change can be introduced in 3.1, but I would also prefer just not allowing givens in pattern definitions, I don't think we need another way of defining givens.

@bishabosha bishabosha changed the title fix #11897: generate defs for given patterns fix #11897: error on given pattern in val def May 31, 2021
@bishabosha bishabosha marked this pull request as ready for review May 31, 2021 18:05
@bishabosha
Copy link
Member Author

This PR has now changed to make it an error to include given patterns in a val definition - this is still source breaking change - so how should it be introduced?

@smarter
Copy link
Member

smarter commented May 31, 2021

Given that it did nothing before and was not advertised as a feature, I'm inclined to get it in without worrying about the hypothetical source compat breakage.

@bishabosha bishabosha force-pushed the fix-11897 branch 3 times, most recently from 5117708 to db24586 Compare June 2, 2021 17:48
Suggest that they use an alias
given instead.
@bishabosha
Copy link
Member Author

I have changed the implementation and adjusted the error message

@smarter smarter merged commit c1f0a56 into scala:master Jun 3, 2021
@smarter smarter deleted the fix-11897 branch June 3, 2021 12:09
@Kordyjan Kordyjan added this to the 3.0.2 milestone Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants