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-11703] inlinable synthesised Equatable, Hashable, ... conformances #54111

Open
weissi opened this issue Nov 2, 2019 · 4 comments
Open

[SR-11703] inlinable synthesised Equatable, Hashable, ... conformances #54111

weissi opened this issue Nov 2, 2019 · 4 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself performance

Comments

@weissi
Copy link
Member

weissi commented Nov 2, 2019

Previous ID SR-11703
Radar rdar://problem/56923074
Original Reporter @weissi
Type Bug
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, Performance
Assignee None
Priority Medium

md5: b1b48782af7210f46523fb8e5c4f37c1

Issue Description:

There is no way (known to us) to get a synthesised Equatable/Hashable conformance to be inlinable. It's a bit tedious to implement it manually just to get it inlinable.

Right now, it would always call into static lib.Foo.__derived_struct_equals(lib.Foo, lib.Foo) -> Swift.Bool for a type Foo in module lib

@beccadax
Copy link
Contributor

beccadax commented Nov 5, 2019

@swift-ci create

1 similar comment
@weissi
Copy link
Member Author

weissi commented Nov 5, 2019

@swift-ci create

@lorentey
Copy link
Member

lorentey commented Nov 7, 2019

This would be appropriate for @Frozen structs and enums only. It probably shouldn’t be enabled by default — there is value in requiring user action to request inlinability. (A frozen struct may still reserve the right to change its hashing; e.g., consider Foundation.Data.)

It would also make sense to allow additional attributes beyond @inlinable — should we implement a full C++-style `= default` syntax?

@weissi
Copy link
Member Author

weissi commented Nov 7, 2019

@lorentey agreed. In the language dialect that SwiftPM uses (and therefore SwiftNIO) however, everything is @frozen. C++ style syntax sounds very sensible to me but for the time being I guess @frozen & the auto-frozen you get when using SwiftPM should imply @inlinable for synthesised stuff.

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

No branches or pull requests

3 participants