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-8512] Poor error messages for use of ternary without space before '?' #51032

Open
huonw mannequin opened this issue Aug 10, 2018 · 0 comments
Open

[SR-8512] Poor error messages for use of ternary without space before '?' #51032

huonw mannequin opened this issue Aug 10, 2018 · 0 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 parser Area → compiler: The legacy C++ parser

Comments

@huonw
Copy link
Mannequin

huonw mannequin commented Aug 10, 2018

Previous ID SR-8512
Radar rdar://problem/22477120
Original Reporter @huonw
Type Bug
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, DiagnosticsQoI, Parser
Assignee None
Priority Medium

md5: 87b882ed51323b93d22c2281c2236ec7

Issue Description:

true?1:0 // should be true ? 1 : 0
ternary.swift:1:6: error: consecutive statements on a line must be separated by ';'
true?1:0
     ^
     ;
ternary.swift:1:7: error: consecutive statements on a line must be separated by ';'
true?1:0
      ^
      ;
ternary.swift:1:7: error: expected expression
true?1:0
      ^
ternary.swift:1:5: error: cannot use optional chaining on non-optional value of type 'Bool'
true?1:0
~~~~^
    
ternary.swift:1:6: warning: integer literal is unused
true?1:0
     ^

It'd be nice if there was fewer of the follow on errors.

(Also, the behaviour is somewhat inconsistent: true ?1:0 works fine, unlike other operators like 1 +0.)

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
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 parser Area → compiler: The legacy C++ parser
Projects
None yet
Development

No branches or pull requests

0 participants