mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
In C, macros can be redefined so long as the redefinitions are tokenwise equivalent. Provide the Clang importer with the same ability by determining when tokenwise equivalent macros would be imported as different Swift declarations, and collapse them into a single declaration.
12 lines
269 B
Swift
12 lines
269 B
Swift
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -I %S/Inputs/custom-modules -parse -verify %s
|
|
|
|
import MacrosRedefA
|
|
import MacrosRedefB
|
|
|
|
func testMacroRedef() {
|
|
var s: String
|
|
s = REDEF_1
|
|
s = REDEF_2 // expected-error{{ambiguous use of 'REDEF_2'}}
|
|
}
|
|
|