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-10816] Changes from SE-0213 break source compatibility in Swift 4 mode #53206

Open
swift-ci opened this issue May 31, 2019 · 1 comment
Open
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself regression swift 5.0

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-10816
Radar None
Original Reporter nonsensery (JIRA User)
Type Bug
Environment
  • macOS

  • Xcode 10.1 (Swift 4.2.1) and Xcode 10.2.1 (Swift 5.0.1)

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, 5.0Regression
Assignee None
Priority Medium

md5: 1d1a6270823a72363a7fad6cc34df65c

relates to:

  • SR-10259 ExpressibleByStringLiteral masks an initializer without any warning in Swift 5.

Issue Description:

Steps to reproduce

Note: This issue affects the Swift-4 mode of the Swift 5 compiler.

  1. Execute the following code sample using both the Swift 4 compiler, and the Swift 5 compiler in Swift-4 compatibility mode:
struct TimeOfDay: ExpressibleByStringLiteral {
    init(_ string: String) {
        print("using init(_:)")
    }

    init(stringLiteral: String) {
        print("using init(stringLiteral:)")
    }
}

TimeOfDay.init("00:00")
TimeOfDay("00:00")

Expected result

The code should behave the same in both.

Actual result

In Swift 4, the output is:

using init(_:)
using init(_:)

In Swift-4 compatibility mode, the output is:

using init(_:)
using init(stringLiteral:)

Discussion

I understand that this change in behavior is the result of SE-0213. But, I think that change was only supposed to affect Swift 5 mode.

See this thread on the Swift forums.

@belkadan
Copy link
Contributor

belkadan commented Jun 3, 2019

cc @xedin

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

No branches or pull requests

3 participants