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

[SR-14153] -module-interface-preserve-types-as-written still qualifies types for synthesized extensions #56532

Open
lilyball mannequin opened this issue Feb 3, 2021 · 1 comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@lilyball
Copy link
Mannequin

lilyball mannequin commented Feb 3, 2021

Previous ID SR-14153
Radar rdar://problem/73985900
Original Reporter @lilyball
Type Bug
Environment

Apple Swift version 5.3.2 (swiftlang-1200.0.45 clang-1200.0.32.28)
Target: x86_64-apple-darwin19.6.0

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee None
Priority Medium

md5: 49dd829d00b59bb7dd0edc9525dda429

Issue Description:

If I have code that gets a synthesized extension, such as

enum Foo: String {
    case one, two
}

and I compile with -Xfrontend module-interface-preserve-types-as-written, the synthesized extensions still qualify the type with the module name:

// swift-interface-format-version: 1.0
// swift-compiler-version: Apple Swift version 5.3.2 (swiftlang-1200.0.45 clang-1200.0.32.28)
// swift-module-flags: -target x86_64-apple-macosx10.10 -enable-objc-interop -enable-library-evolution -swift-version 5 -O -module-name Module
public enum Foo : String {
  case one, two
  public typealias RawValue = Swift.String
  public init?(rawValue: Swift.String)
  public var rawValue: Swift.String {
    get
  }
}
extension SameName.Foo : Swift.Equatable {}
extension SameName.Foo : Swift.Hashable {}
extension SameName.Foo : Swift.RawRepresentable {}

Not just the extensions, but also the synthesized members of Foo use qualified names such as Swift.String, though that's a lot less likely to be a problem.

This causes issues when trying to use -module-interface-preserve-types-as-written to work around a name collision issue as documented in SR-14142.

@typesanitizer
Copy link

@swift-ci create

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself
Projects
None yet
Development

No branches or pull requests

1 participant