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-5130] Single-tuple and multiple-argument function types should be treated as different types #47706

Closed
jepers opened this issue Jun 6, 2017 · 1 comment
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself type checker Area → compiler: Semantic analysis

Comments

@jepers
Copy link

jepers commented Jun 6, 2017

Previous ID SR-5130
Radar rdar://problem/32601620
Original Reporter @jepers
Type Bug
Status Closed
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, TypeChecker
Assignee @rudkx
Priority Medium

md5: 1aa010cf2030ddedb6627eee90ec80cf

Issue Description:

Swift should properly distinguish between single-tuple and multiple-argument function types.
But it isn't, as demonstrated below.
The following is the behavior of swift-DEVELOPMENT-SNAPSHOT-2017-06-05-a-osx (-swift-version 4):

func add(_ a: Int, _ b: Int) -> Int { return a + b }
let a: (Int, Int) -> Int = add
let b: ((Int, Int)) -> Int = add // OK, but why isn't it an error?
print(a(1, 2)) // 3
print(b((1, 2))) // 3
// I would not expect the assignment to b to compile since the func `add`
// does not have the type ((Int, Int)) -> Int.

(Reported as requested by Mark Lacey here:
https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20170605/037013.html
)

@rudkx
Copy link
Member

rudkx commented Jun 7, 2017

@swift-ci create

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

No branches or pull requests

2 participants