Skip to content

Conversation

@egorzhdan
Copy link
Contributor

AppKit defines certain constants in Objective-C, and then renames them into different constants in Swift, e.g. NSUpArrowFunctionKey is renamed into NSEvent.SpecialKey.upArrow.rawValue.

In addition to that, AppKit also re-defines these constants in pure-Swift, which isn't the intended mechanism for renaming such constants.

Prior to llvm/llvm-project#145947, Clang was silently dropping the SwiftName API Notes attributes on these constants due to a bug in the name validation mechanism. Clients of AppKit relied on that behavior and continued to use the old spelling in Swift. To preserve source compatibility and avoid a deprecation error, let's continue dropping the SwiftName attribute on select constants from AppKit.

rdar://157485334

AppKit defines certain constants in Objective-C, and then renames them into different constants in Swift, e.g. `NSUpArrowFunctionKey` is renamed into `NSEvent.SpecialKey.upArrow.rawValue`.

In addition to that, AppKit also re-defines these constants in pure-Swift, which isn't the intended mechanism for renaming such constants.

Prior to llvm/llvm-project#145947, Clang was silently dropping the `SwiftName` API Notes attributes on these constants due to a bug in the name validation mechanism. Clients of AppKit relied on that behavior and continued to use the old spelling in Swift. To preserve source compatibility and avoid a deprecation error, let's continue dropping the `SwiftName` attribute on select constants from AppKit.

rdar://157485334
@egorzhdan egorzhdan added the c++ interop Feature: Interoperability with C++ label Aug 6, 2025
@egorzhdan
Copy link
Contributor Author

@swift-ci please test

@tshortli

This comment was marked as outdated.

@tshortli

This comment was marked as outdated.

@tshortli
Copy link
Contributor

tshortli commented Aug 7, 2025

@swift-ci please test macOS

@tshortli
Copy link
Contributor

tshortli commented Aug 7, 2025

@swift-ci please test Windows

@egorzhdan egorzhdan merged commit ab5fc57 into swiftlang:main Aug 12, 2025
5 checks passed
@egorzhdan egorzhdan deleted the egorzhdan/nsfunctionkeys-workaround branch September 11, 2025 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ interop Feature: Interoperability with C++

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants