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

Move ExpressibleByArrayLiteral conformance of _TinyArray to the declaring module #157

Merged
merged 3 commits into from
Dec 5, 2023

Conversation

dnadoba
Copy link
Member

@dnadoba dnadoba commented Dec 5, 2023

Motivation

Nightly compilers start complaining about retroactive conformances.

Modifications

  • move conformance to declaring module
  • optimise code to not allocate
  • add tests

Result

no warning. optimal generated code for:

func foo1(int: Int) -> _TinyArray<Int> {
    [int]
}

which now compiles down to:

output.foo1(int: Swift.Int) -> output._TinyArray<Swift.Int>:
        mov     rax, rdi
        xor     edx, edx
        ret

(only with nightly compiler)

https://godbolt.org/z/a91fPe6or

…eclaring module

Motivation

Nightly compilers start complaining about retroactive conformances.

Modifications

- move conformance to declaring module
- optimise code to not allocate

Result

no warning, optimal generated code for:

```swift
func foo1(int: Int) -> _TinyArray<Int> {
    [int]
}
```

compiles down to:
```
output.foo1(int: Swift.Int) -> output._TinyArray<Swift.Int>:
        mov     rax, rdi
        xor     edx, edx
        ret
```

https://godbolt.org/z/a91fPe6or
@dnadoba
Copy link
Member Author

dnadoba commented Dec 5, 2023

Sendable conformance for Date on non-darwin platforms has landed with Swift 5.9.1: swiftlang/swift-corelibs-foundation@c667dda

Copy link
Contributor

@Lukasa Lukasa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice clean patch, thanks @dnadoba

@Lukasa Lukasa added the 🆕 semver/minor Adds new public API. label Dec 5, 2023
@Lukasa Lukasa merged commit 66143b8 into apple:main Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🆕 semver/minor Adds new public API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants