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

[SR-10298] Missing whitespace between ... operator and placeholder throws off parser #52698

Closed
xedin opened this issue Apr 3, 2019 · 2 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself diagnostics QoI Bug: Diagnostics Quality of Implementation good first issue Good for newcomers parser Area → compiler: The legacy C++ parser

Comments

@xedin
Copy link
Member

xedin commented Apr 3, 2019

Previous ID SR-10298
Radar rdar://problem/24395200
Original Reporter @xedin
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, DiagnosticsQoI, Parser, StarterBug
Assignee sasilukr (JIRA)
Priority Medium

md5: aa56ec4a5451b5abce6337736c4a795c

Issue Description:

Lack of whitespace between ... operator and placeholde token, e.g. ...<#blah#> throws off the compiler so instead of reporting the expected "editor placeholder in source file" error, it throws several other errors and produces a bad AST with incorrect source ranges.

for i in 1 ...<#number#> {
}
error: expected '{' to start the body of for-each loop
for i in 1 ...<#number#> {
           ^
error: statement cannot begin with a closure expression
for i in 1 ...<#number#> {
                         ^
note: explicitly discard the result of the closure by assigning to '_'
for i in 1 ...<#number#> {
                         ^
                         _ = 
error: braced block of statements is an unused closure
for i in 1 ...<#number#> {
                         ^
(source_file
  (top_level_code_decl
    (brace_stmt
      (for_each_stmt
        (pattern_named 'i')
        (pattern_named 'i')
        (integer_literal_expr type='<null>' value=1)
        (brace_stmt))))
  (top_level_code_decl
    (brace_stmt
      (closure_expr type='<null>' discriminator=0
        (parameter_list)
        (brace_stmt)))))
@swift-ci
Copy link
Collaborator

swift-ci commented Jul 1, 2019

Comment by Atharva Vaidya (JIRA)

I tried to reproduce this and it showed me 3 errors. The first one was the expected, "Editor placeholder in file". The others were the same as you have mentioned.

@xedin
Copy link
Member Author

xedin commented Jul 1, 2019

Which means that it's already fix, thank you for confirmation!

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself diagnostics QoI Bug: Diagnostics Quality of Implementation good first issue Good for newcomers parser Area → compiler: The legacy C++ parser
Projects
None yet
Development

No branches or pull requests

2 participants