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-11580] FloatLiteralExprSyntax and IntegerLiteralExprSyntax should have computed properties that return their integer/float value #415

Closed
ahoppen opened this issue Oct 7, 2019 · 2 comments

Comments

@ahoppen
Copy link
Collaborator

ahoppen commented Oct 7, 2019

Previous ID SR-11580
Radar None
Original Reporter @ahoppen
Type New Feature
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s SwiftSyntax
Labels New Feature, StarterBug
Assignee vermont42 (JIRA)
Priority Medium

md5: b8b8d3a1a602fe052d3a131ced13afd6

Issue Description:

Often, when dealing with FloatLiteralExprSyntax or IntegerLiteralExprSyntax, you want to get the value they represent. SwiftSyntax should provide computed properties that return these.

The catch with it is, that we need to support all kinds of literals that are supported in Swift. In addition to the obvious ones this includes:

  • Literals with underscores

  • Hexadecimal int literals

  • Octal int literals

  • Binary int literals

  • Exponential float literals (e.g. 5e+2)

  • Hexadecimal float literals with possible exponents (e.g. 0x5.fp+2)

#148 started implementing these but gave up on the less obvious literals.

@swift-ci
Copy link
Contributor

swift-ci commented Aug 3, 2020

Comment by Josh Adams (JIRA)

After corresponding with @ahoppen and performing some exploratory work here, I have assigned myself this story. I intend to raise a PR when development is complete.

@swift-ci
Copy link
Contributor

Comment by Josh Adams (JIRA)

Implemented in these two PRs.

@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
…ypes

Fix formatting of primary associated type clauses in protocols.
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants