Skip to content

Allow given in constructor applications #6488

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 8 commits into from
May 16, 2019

Conversation

odersky
Copy link
Contributor

@odersky odersky commented May 10, 2019

Based on #6486.

odersky added 8 commits May 9, 2019 16:55
So far pathTo(span) would only guarantee to return the path
to the closest tree enclosing `span` if trees were non-overlapping.
This is property does not hold for typed trees, yet `pathTo` is called
from `Interactive` on such typed trees.

This commit makes `pathTo` work correctly also for overlapping trees.
With given coming last, some of the no-overlaps and in-order position
checks have to be weakened. But with the more generalized pathTo
implementation, non-overlapping and in-order is not really needed anymore.
They printed as normal arguments before.
The previous syntax was unparseable without major contortions in the Parser.
@biboudis
Copy link
Contributor

biboudis commented May 16, 2019

I tried the following:

class C2(val n: Int) given List[TC] extends AnyVal 

and I got what I expected: value class can only have one non erased parameter

Maybe we need to fine tune this error message. What do you think? Otherwise looks good.

@odersky
Copy link
Contributor Author

odersky commented May 16, 2019

Maybe we need to fine tune this error message. What do you think? Otherwise looks good.

I agree there's room for improvement, but it's not urgent. What one could do is add a note to the error message saying that given clauses count as parameters as well.

@biboudis biboudis merged commit 4693a88 into scala:master May 16, 2019
@biboudis biboudis deleted the given-constr branch May 16, 2019 12:59
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.

2 participants