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-1051] Implement SE-0042 - Flattening the function type of unapplied method references #43663

Open
lattner mannequin opened this issue Mar 24, 2016 · 11 comments
Open
Labels
compiler The Swift compiler in itself improvement

Comments

@lattner
Copy link
Mannequin

lattner mannequin commented Mar 24, 2016

Previous ID SR-1051
Radar rdar://problem/25878529
Original Reporter @lattner
Type Improvement
Status In Progress
Resolution
Additional Detail from JIRA
Votes 1
Component/s Compiler
Labels Improvement
Assignee jaspa (JIRA)
Priority Medium

md5: c0489b3d664c0051f324983f13c46c29

Issue Description:

SE-0042 has been accepted:
https://github.com/apple/swift-evolution/blob/master/proposals/0042-flatten-method-types.md

We need an implementation now!

@swift-ci
Copy link
Collaborator

Comment by Janek Spaderna (JIRA)

#3836

@benrimmington
Copy link
Collaborator

@jckarter or @slavapestov, does this bug need to be added to the ABI Dashboard?

@jckarter
Copy link
Member

It doesn't affect ABI, it's only a source-level behavior change.

@slavapestov
Copy link
Member

This change would not affect ABI, but it does clearly have source compatibility impact so if we ever implement this proposal it would need to be staged in with a -swift-version flag.

However I think at this point it would have to go through review again and it would be unlikely to be accepted without changes. One option is to deprecate the old unapplied method reference syntax, and instead use keypath syntax, for example \Foo.bar, which would have the new type.

@benrimmington
Copy link
Collaborator

Thanks, there was a suggestion to retool thunks to have the new uncurried type by default, so I thought it might affect ABI.

@jckarter
Copy link
Member

Those kinds of thunks generally have private linkage, since they can be generated at will by any module that needs them.

@sveinhal
Copy link

What's the status on this? Has it been abandoned?

@DevAndArtist
Copy link
Mannequin

DevAndArtist mannequin commented Apr 11, 2019

@slavapestov even though this is super old, the idea going the key-path way seems good, but in some cases it is not possible because key-paths require hashability, which means that function parameter types and the result type also would need to be hashable.

@jckarter
Copy link
Member

Key path literals don't need to be constrained to hashability in function context. Functions aren't hashable.

@DevAndArtist
Copy link
Mannequin

DevAndArtist mannequin commented Apr 11, 2019

Ah, then you are saying that the key path literal will be transformed into a closure just like the recently accepted proposal? Otherwise I‘m not sure I follow.

@slavapestov
Copy link
Member

> Ah, then you are saying that the key path literal will be transformed into a closure just like the recently accepted proposal?

Yes, that would be the idea. We should also transform unapplied method references to closures too, and remove all the SILGen support for "curry thunks".

@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
compiler The Swift compiler in itself improvement
Projects
None yet
Development

No branches or pull requests

5 participants