-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Permit new with trivial end #24331
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
base: main
Are you sure you want to change the base?
Permit new with trivial end #24331
Conversation
Why would we want that? It doesn't seem to follow the rule that |
|
I thought the rule was that you can remove the marker without changing semantics, but that does not hold. I'll try that out. Why doesn't github offer embedded REPL? This obeys the Odersky blank line rule: |
I remember the argument for was that I'm in the middle of editing, though I don't know if that's why it was finally allowed. But the same applies. The least github could do is test my late-night snippets in the browser. |
|
The thing is that |
|
Yeah, maybe. I'm not wedded to any of this. Is colon enough of an indicator? if I can write and I'm not sure they will yet, but my point is |
I'll update to read "or a very small region." Joke. But this is clear:
That is at https://dotty.epfl.ch/docs/reference/other-new-features/indentation.html#the-end-marker |
43ea0cc to
dc50485
Compare
| if MigrationVersion.Scala2to3.needsPatch then | ||
| patch(source, Span(in.offset), " ") | ||
|
|
||
| def possibleTemplateStart(isNew: Boolean = false): Unit = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isNew was never used
|
|
||
| def possibleTemplateStart(isNew: Boolean = false): Unit = | ||
| def possibleTemplateStart(): Unit = | ||
| possiblyNewTemplateStart(): Unit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ignores the boolean value
| val body = | ||
| val bo = templateBodyOpt(emptyConstructor, parents, derived = Nil) | ||
| if !indented then reposition(bo) else bo | ||
| New(body) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
preserves existing behavior, but what is the span of the result?
| else parent | ||
| case parents => | ||
| // With brace syntax, the last token consumed by a parser is }, but with indent syntax, | ||
| // the last token consumed by a parser is OUTDENT, which causes mismatching spans, so don't reposition. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment inlined from the previous PR
| @@ -0,0 +1,5 @@ | |||
|
|
|||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to break the habit of inserting an initial blank line in test sources?
Fixes #24250
Make trivial
end newuseful by supplying the empty template in parser.This makes
equivalent to