mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
- **Explanation**: USR mangling can include an extension context infix (`AAE`) when an extended type uses `@_originallyDefinedIn` on platforms other than the active one. This adds a check for the `RespectOriginallyDefinedIn` flag when checking extension decls against their extended type. - **Scope**: Changes USR mangling in these situations so that USRs are the same for the same code regardless of platform. - **Issues**: rdar://152598492 - **Original PRs**: https://github.com/swiftlang/swift/pull/82348 - **Risk**: Low. The change is limited to situations where the name mangler is already disrespecting the alternate module name, and only additionally turns on that flag for any USR mangling. - **Testing**: Automated tests - **Reviewers**: @edymtt @augusto2112
23 lines
1.1 KiB
Swift
23 lines
1.1 KiB
Swift
// RUN: %empty-directory(%t)
|
|
// RUN: %empty-directory(%t/macos)
|
|
// RUN: %empty-directory(%t/ios)
|
|
|
|
// RUN: %target-swift-frontend -target %target-cpu-apple-macos %s -module-name OriginallyDefinedInExtension -emit-module -emit-module-path %t/macos/OriginallyDefinedInExtension.swiftmodule -emit-symbol-graph -emit-symbol-graph-dir %t/macos/
|
|
// RUN: %FileCheck %s --input-file %t/macos/OriginallyDefinedInExtension.symbols.json
|
|
// RUN: %target-swift-frontend -target %target-cpu-apple-ios-simulator %s -module-name OriginallyDefinedInExtension -emit-module -emit-module-path %t/ios/OriginallyDefinedInExtension.swiftmodule -emit-symbol-graph -emit-symbol-graph-dir %t/ios/
|
|
// RUN: %FileCheck %s --input-file %t/ios/OriginallyDefinedInExtension.symbols.json
|
|
|
|
// CHECK: "precise":"s:28OriginallyDefinedInExtension12SimpleStructV05InnerF0V"
|
|
|
|
// REQUIRES: SWIFT_SDK=osx
|
|
// REQUIRES: SWIFT_SDK=ios_simulator
|
|
|
|
@available(macOS 10.8, *)
|
|
@_originallyDefinedIn(module: "another", macOS 11.0)
|
|
public struct SimpleStruct {}
|
|
|
|
@available(macOS 12.0, iOS 13.0, *)
|
|
public extension SimpleStruct {
|
|
struct InnerStruct {}
|
|
}
|