mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Swift names provided via C attributes or API notes can be parsed as special names, such as `init` or `subscript`. However, doing so would cause the Clang importer to crash, because it assumes that these names are always identifiers. In these places, we actually want to treat them as identifiers, where special names are mapped back to their keywords. Introduce a function to do that, and use it consistently.
9 lines
235 B
Swift
9 lines
235 B
Swift
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck %s -verify
|
|
|
|
import enums_using_attributes
|
|
|
|
func testEvent(event: Event) {
|
|
if event == .`init` { print("Initialize") }
|
|
if event == .reset { print("Reset") }
|
|
}
|