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-5129] Don't treat func signatures as being the same when they are in fact different #47705

Closed
jepers opened this issue Jun 6, 2017 · 7 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@jepers
Copy link

jepers commented Jun 6, 2017

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

md5: 508c5675ce49fc41b6be9c9ff13af9e0

duplicates:

  • 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):

// The second func results in error: "Invalid redeclaration of 'foo'"
func foo(_ fn: (Int, Int) -> ()) { print("I got a func of two ints!") }
func foo(_ fn: ((Int, Int)) -> ()) { print("I got a func of a tuple of two ints!") }
// I would expect this to compile since the args of the two
// foo functions are of different types.

(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

In ValueDecl::getOverloadSignature, we’re canonicalizing the result of calling mapSignatureFunctionType. It also looks like within mapSignatureFunctionType we use getAs<TupleType> which will walk past the ParenType. If we then reform the type we end up dropping the ParenType:

      if (anyChanged) {
        argTy = TupleType::get(elements, ctx);

@slavapestov
Copy link
Member

Same issue as SR-5112.

@palimondo
Copy link
Mannequin

palimondo mannequin commented Jun 5, 2018

Sorry for the extra traffic, I just wanted to make sure all the various test cases that expose the same bug are at least linked in the bug tracker with proper links. Jens, if the devs sometimes forget to set the duplicate in the system and just comment about that, you can do it for them. Instead of `Close Issue`, use `Resolve Issue` first. From `Resolution` drop down select `Duplicate`, then from `Linked Issues` drop down select “duplicates” and fill the master bug in the `Issue` field. Now you can finally `Resolve`. After all this is done, `Close Issue`. I know proper process hygiene isn’t much fun in JIRA, but it helps to keep thing in order. This is Swift’s institutional memory.

@jepers
Copy link
Author

jepers commented Jun 5, 2018

Thank you Pavol, much appreciated, will try to remember that next time!

@jepers
Copy link
Author

jepers commented Jun 5, 2018

Just to make sure I'm not doing this wrong too:

When one of my issues has been marked "resolved" by the devs, after fixing the issue, am I correct in that I should "close" it after verifying that I can no longer reproduce it?

@palimondo
Copy link
Mannequin

palimondo mannequin commented Jun 5, 2018

From memory... (Can't find other docs than this forum post) I think you should close it after you verify it solved the problem for you.

It's a bit unclear, but I think if you should wait for the fix to ship in a release version.
(Probably depends on the version you're reporting from...)

@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

3 participants