-
Notifications
You must be signed in to change notification settings - Fork 323
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
Inline doc comment is a compiler error #11333
Conversation
This should be a syntax error, so I added some parser changes. |
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.
approving the JS test 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.
Reviewed the rust part. Nitpicks only, quite optional
@@ -89,6 +92,7 @@ impl<'s, Inner: TreeConsumer<'s>> CompoundTokens<'s, Inner> { | |||
if let Some(tree) = self.compounding.take().and_then(|builder| builder.flush()) { | |||
self.inner.push_tree(tree); | |||
} | |||
self.has_preceding_item = default(); |
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.
Personally, I'd prefer false
, as more "readable"
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.
false
would be simpler, but IMO it's more important here to express that the field is reset to its initial state than to emphasize the value of that state. I'd reinitialize the whole struct here, if it weren't for performance.
@@ -260,18 +277,21 @@ impl<'s> CompoundTokenBuilder<'s> for TextLiteralBuilder<'s> { | |||
} | |||
|
|||
fn flush(self) -> Option<Tree<'s>> { | |||
let Self { open, newline, elements } = self; | |||
let Self { open, newline, elements, has_preceding_item: _ } = self; |
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.
A shorter form would be
let Self { open, newline, elements, has_preceding_item: _ } = self; | |
let Self { open, newline, elements, .. } = self; |
Unless you really want to have an error here when another field will be added.
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.
Fields that can correctly be ignored here are the exception.
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.
Test written and CI is green. Good!
Pull Request Description
Fix NPE thrown when compiling source with inline documentation comments, like
Important Notes
Checklist
Please ensure that the following checklist has been satisfied before submitting the PR:
Scala,
Java,
TypeScript,
and
Rust
style guides. In case you are using a language not listed above, follow the Rust style guide.
or the Snowflake database integration, a run of the Extra Tests has been scheduled.