Skip to content

Fix #7669: Implement extended with syntax for extension methods. #7670

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 11 commits into from
Dec 4, 2019

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Dec 3, 2019

Based on #7657

 - Break out optional `with` from TemplateBody production
 - Disallow `new with { ...}`.
We don't actually solve this one. `given` still applies to all parameters
in a clause.
Don't allow extension methods to have type parameters if collective
type parameters were already given. The reason to disallow is that
we don't support multiple consecutive type argument sections yet.
And merging two type parameter sections into one would break a future
extension where we do allow multiple consecutive type argument sections.
So far we allowed `given A, B with ... `
but not `given A with B with ... `
Implement `extended with` syntax for extension methods.
constrApps(commaOK = true, templateCanFollow = true)
else if in.token == SUBTYPE then
if !mods.is(Inline) then
syntaxError("`<:' is only allowed for given with `inline' modifier")
Copy link
Member

Choose a reason for hiding this comment

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

Use `<:` instead of `<:' (same with inline) ? Both conventions seem to be used in the parser, but markdown-like syntax is probably more user-friendly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let's discuss which one to use and then standardize. I'll open an issue.

@odersky odersky merged commit d217690 into scala:master Dec 4, 2019
@odersky odersky deleted the change-extended branch December 4, 2019 06:44
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