Skip to content

[5.1] [ModuleInterface] Qualify all types in module interfaces #25488

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

Merged

Conversation

harlanhaskins
Copy link
Contributor

We should not be making assumptions about module lookup when we're
compiling a module interface, so instead print the types fully
qualified.

rdar://48445154

@harlanhaskins
Copy link
Contributor Author

Reviewed by @jrose-apple

@harlanhaskins harlanhaskins changed the title [ModuleInterface] Qualify all types in module interfaces [5.1] [ModuleInterface] Qualify all types in module interfaces Jun 14, 2019
@harlanhaskins
Copy link
Contributor Author

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - cb89e029fee57c2f76915a7aa14fae7e67fa0e06

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - cb89e029fee57c2f76915a7aa14fae7e67fa0e06

Harlan Haskins added 5 commits June 17, 2019 10:00
We should not be making assumptions about module lookup when we're
compiling a module interface, so instead print the types fully
qualified.

rdar://48445154
There are still cases (a module with a type that's the same name as the
module) where we cannot fully qualify all types. In those cases, allow
them to remain unqualified with a flag, `-Xfrontend
-preserve-types-as-written-in-module-interface`.
This check wasn't ever correct, because the fact that the the protocol comes
from another module doesn't change the fact that the type is valid for lookup
within this module. It incorrectly rejects the following, valid code:

```swift
// In A.swift
public protocol A {}
```

```
// In B.swift
import A

extension A {
  typealias B = Int
  func b(_ b: Self.B) {}
}
```
@harlanhaskins
Copy link
Contributor Author

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - cb89e029fee57c2f76915a7aa14fae7e67fa0e06

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - cb89e029fee57c2f76915a7aa14fae7e67fa0e06

@harlanhaskins harlanhaskins merged commit 81f4b90 into swiftlang:swift-5.1-branch Jun 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants