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-5127] Single-tuple and multiple-argument function types should not be considered equal #47703

Closed
jepers opened this issue Jun 6, 2017 · 2 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.

Comments

@jepers
Copy link

jepers commented Jun 6, 2017

Previous ID SR-5127
Radar rdar://problem/32601617
Original Reporter @jepers
Type Bug
Status Closed
Resolution Duplicate
Additional Detail from JIRA
Votes 0
Component/s
Labels Bug
Assignee None
Priority Medium

md5: f4aebff9d8ffdd693c150f9fd0518f46

blocks:

  • SR-5112 Not correct function types in Swift4 (typeof)

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 f(_ a: Int, _ b: Int) { print("\(a), \(b)") }
func g(_ tuple: (Int, Int)) { print("\(tuple)") }
f(1, 2) // 1, 2
g((1, 2)) // (1, 2)
// Working as expected.

// But:
print(type(of: f) == type(of: g)) // true (!?)

// Or, simpler put:
print(
    type(of: ((Int, Int) -> Int).self) ==
    type(of: (((Int, Int)) -> Int).self)
) // true

(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

@rudkx
Copy link
Member

rudkx commented Jun 7, 2017

I took a look at this and determined what's seen here is due to the same issue as SR-5112.

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

No branches or pull requests

2 participants