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

Streamline given syntax #12107

Merged
merged 1 commit into from
Apr 20, 2021
Merged

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Apr 15, 2021

A simple fix for the problem that

given SomeClass with {}

is ugly and

given SomeClass = SomeClass()

is repetitive: We now also allow

given SomeClass()

It can't be confused for an abstract given clause because of the ().

A simple fix for the problem that
```scala
given SomeClass with {}
```
is ugly and
```scala
given SomeClass = SomeClass()
```
is repetitive: We now also allow
```scala
given SomeClass()
```
It can't be confused for an abstract given clause because of the `()`.
Copy link
Contributor

@liufengyun liufengyun left a comment

Choose a reason for hiding this comment

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

LGTM

@liufengyun
Copy link
Contributor

As a note, this fix also works for the following case (already in the test):

   class Ctx(x: Int)
-  given Ctx(5) with {}
+  given Ctx(5)

@liufengyun liufengyun merged commit b7d2a12 into scala:master Apr 20, 2021
@liufengyun liufengyun deleted the streamline-given-syntax branch April 20, 2021 20:37
tgodzik added a commit to tgodzik/scalameta that referenced this pull request Jul 13, 2021
tgodzik added a commit to tgodzik/scalameta that referenced this pull request Jul 13, 2021
tgodzik added a commit to tgodzik/scalameta that referenced this pull request Jul 13, 2021
@Kordyjan Kordyjan added this to the 3.0.1 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
Development

Successfully merging this pull request may close these issues.

None yet

3 participants