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-5780] Swift 4 compiler reports ambiguity for method invocation #48350

Open
swift-ci opened this issue Aug 28, 2017 · 1 comment
Open

[SR-5780] Swift 4 compiler reports ambiguity for method invocation #48350

swift-ci opened this issue Aug 28, 2017 · 1 comment
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself regression swift 4.0 type checker Area → compiler: Semantic analysis

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-5780
Radar None
Original Reporter charles (JIRA User)
Type Bug

Attachment: Download

Environment

$ uname -a

Darwin charles-mbp.lan 16.7.0 Darwin Kernel Version 16.7.0: Thu Jun 15 17:36:27 PDT 2017; root:xnu-3789.70.16~2/RELEASE_X86_64 x86_64

$ swift --version

Apple Swift version 4.0 (swiftlang-900.0.59 clang-900.0.34.2)

Target: x86_64-apple-macosx10.9

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, 4.0Regression, TypeChecker
Assignee @xedin
Priority Medium

md5: 6ceddd383b8e1d645fed68d4847dae68

relates to:

  • SR-2423 Ambiguous use of method in unambiguous case

Issue Description:

Possibly related to SR-2423?

The following code (also attached) :

func foo<T>(closure: (T) -> Void) {}

func foo<T, U>(closure: (T, U) -> Void) {}

foo(closure: { (arg1: String, arg2: String) in })

Produces the following output when compiled as swift 4 code using the version of swift provided in Xcode 9 beta 6 (compiling as swift 3 works as expected):

Ambiguity.swift:4:1: error: ambiguous use of 'foo(closure🙂'

foo(closure: { (arg1: String, arg2: String) in })

^``Ambiguity.swift:1:6: note: found this candidate

func foo<T>(closure: (T) -> Void) {}

{{ ^}}

Ambiguity.swift:2:6: note: found this candidate

func foo<T, U>(closure: (T, U) -> Void) {}

{{ ^}}

@belkadan
Copy link
Contributor

@xedin, @rudkx?

@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 4.0 type checker Area → compiler: Semantic analysis
Projects
None yet
Development

No branches or pull requests

3 participants