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-14552] SwiftSyntax crashes when parsing a malformed function type #400

Closed
allevato opened this issue Apr 30, 2021 · 2 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@allevato
Copy link
Collaborator

Previous ID SR-14552
Radar rdar://problem/77391988
Original Reporter @allevato
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Additional Detail from JIRA
Votes 0
Component/s SwiftSyntax
Labels Bug
Assignee @ahoppen
Priority Medium

md5: 103052cad603311e83a1a277c4a8f594

Issue Description:

This is a repro of a case that recently started failing in one of swift-format's tests against the main branch (I'm using the 2021-04-26 development snapshot as my current environment).

When parsing the following source code:

{{ let x: (A -> B)}}

(Note that "A" should have its own parentheses surrounding it for this to be valid.)

The parser crashes with the following message:

Assertion failed: (isValid() && "length does not make sense for an invalid range"), function getByteLength, file /Users/buildnode/jenkins/workspace/oss-swift-package-macos/swift/include/swift/Basic/SourceLoc.h, line 218.

I would expect this to fail in some other, non-crashing fashion, such as expressing the syntax using Unknown* nodes.

To reproduce:

  1. Download the attached project.

  2. Use a development toolchain that is syntax-compatible with swift-syntax's main branch (at the time I'm writing this, 2021-04-26 worked).

  3. Run swift run TriviaCrash.

@ahoppen
Copy link
Collaborator

ahoppen commented Apr 30, 2021

@swift-ci create

@ahoppen
Copy link
Collaborator

ahoppen commented May 4, 2021

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 9, 2022
adevress pushed a commit to adevress/swift-syntax that referenced this issue Jan 14, 2024
Fix multiple issues in `switch/case` merging.
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants