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-3504] #fileLiteral and #imageLiteral allow non-static strings #46092

Closed
swift-ci opened this issue Dec 28, 2016 · 3 comments
Closed

[SR-3504] #fileLiteral and #imageLiteral allow non-static strings #46092

swift-ci opened this issue Dec 28, 2016 · 3 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-3504
Radar None
Original Reporter micah.hainline@gmail.com (JIRA User)
Type Bug
Status Resolved
Resolution Won't Do
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee @xwu
Priority Medium

md5: 5652fb313e901e0b4b5f7dfc56c19bdf

Issue Description:

According to SE-0039 the #fileLiteral and #imageLiteral were supposed to have been limited to string literals known at compile-time. Instead, they are not limited in this way, allowing regular strings as well as interpolated strings. This should be fixed to emit a compile error.

Likewise, the exposed init on URL from the protocol _ExpressibleByFileReferenceLiteral URL.init(fileReferenceLiteralResourceName name: String) should be typed to take in only a StaticString and Image.init(imageLiteralResourceName name: String) should do the same.

@swift-ci
Copy link
Collaborator Author

Comment by Micah Hainline (JIRA)

Note that I've been validating this in a normal Swift project rather than a playground.

@xwu
Copy link
Collaborator

xwu commented Dec 28, 2016

PR #6503

@xwu
Copy link
Collaborator

xwu commented Jan 8, 2017

As mentioned in the PR, the core team decided not to proceed with such a change and will amend the proposal instead to allow variables in object literals.

@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
Projects
None yet
Development

No branches or pull requests

2 participants