-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix #10648: Fixes of syntax documentation #10658
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
Conversation
There are now two syntax.md files, one in docs/reference, the other in docs/internal.
It will be a bit painful to keep the two in sync, but it's better to have amn official, stable syntacx summary in the official documentation. |
974cf5c
to
44514a3
Compare
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.
Copying the two syntax documents indeed leads to additional maintenance effort. Should we just present the diff in internals and link to the official one?
docs/docs/internals/syntax.md
Outdated
@@ -1,6 +1,6 @@ | |||
--- | |||
layout: doc-page | |||
title: "Scala Syntax Summary" | |||
title: "Scala3 Syntax Summary" |
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.
title: "Scala3 Syntax Summary" | |
title: "Scala 3 Syntax Summary" |
@@ -190,7 +190,7 @@ object ExtensionMethods { | |||
// See the documentation of `memberSignature` to understand why `.stripPoly.ensureMethodic` is needed here. | |||
candidates filter (c => FullParameterization.memberSignature(c.info) == imeth.info.stripPoly.ensureMethodic.signature) | |||
assert(matching.nonEmpty, | |||
i"""no extension method found for: | |||
i"""no extension method found for |
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 this an accidental change?
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.
Well spotted. Yes, that was my regex search misfiring...
RefinedType ::= AnnotType {[colonEol] Refinement} | ||
Template ::= InheritClauses [colonEol] [TemplateBody] | ||
EnumDef ::= id ClassConstr InheritClauses [colonEol] EnumBody | ||
Packaging ::= ‘package’ QualId [nl | colonEol] ‘{’ TopStatSeq ‘}’ |
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.
Maybe I am missing something, but I cannot recognize the colonEol
in the parser code for packages:
Is rewriteWithColon
doing this?
The comment above also does not reflect the colon:
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.
It's in possibleTemplateStart()
. I added a test to verify that :
is indeed significant.
tests/neg/i5773.scala
Outdated
@@ -23,7 +23,7 @@ object Main { | |||
21 | println(1 appendS 2) | |||
| ^^^^^^^^^ | |||
|value appendS is not a member of Int. | |||
|An extension method was tried, but could not be fully constructed: |
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.
Like the change in the source, is this intended?
327f7ab
to
06abeb7
Compare
@odersky there are also still occurrences of |
@b-studios I think I got them all now. I was looking for " extension.*:$" so extensions starting in the first column slipped through. |
@@ -103,7 +103,7 @@ a single extension and enclose all methods in braces or an indented region follo | |||
Example: |
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.
The text above this line would also need to be adjusted.
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.
Well spotted. I'll update the doc.
c2d80fa
to
943bf9e
Compare
The fixes omit documenting `:` in extension blocks. These will be disabled in a separate commit. There are two reasons for omitted in `:` in extensions: - they are not needed, and there should be one way to do things - they are confusing since everywhere else a `:` at eol starts a new scope, but here it doesn't.
- cleanup rules - drop sidebar with tree node info - put in reference directory and link with sidebar
Everytime I clean everything a new version of QuotesImpl is merged that brings back the `:`s...
I'm trying hard to understand this reasoning but I can't make sense of it. Pretty much everywhere else we have trailing |
Fix documentation about indentation syntax. Also fix syntax summary (globally).
The fixes omit documenting : in extension blocks. These are disabled
in a separate commit.
There are two reasons for omitted in : in extensions:
new scope, but here it doesn't.