Skip to content

[ModuleInterface] Avoid ambiguities in swiftinterfaces by writing aliases for module names #61941

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
merged 7 commits into from
Nov 7, 2022

Conversation

xymus
Copy link
Contributor

@xymus xymus commented Nov 4, 2022

Ambiguities are introduced in generated swiftinterfaces when a type shares a name with a module. This PR introduces a workaround (behind a flag) that uses the module-alias feature to avoid these ambiguities. Writing module references with a distinguishable prefix should allow normal type-checking to avoid the usual ambiguities.

We should still aim for a proper fully-qualified name syntax, but this may help in the mean time. I'm considering enabling this by default in the future, but I'll have to write more tests before it's reliable enough in all cases to do so.

rdar://101969500

xymus added 7 commits November 4, 2022 11:10
Ambiguities are introduced in generated swiftinterfaces when a type
shares a name with a module (i.e. XCTest). This workaround uses the
module-alias feature to avoid these ambiguities. Writing module
references with a distinguishable prefix should allow normal
type-checking to avoid the usual ambiguities.

We should still aim for a proper fully-qualified named syntax, but this
may help in the mean time.

rdar://101969500
@xymus
Copy link
Contributor Author

xymus commented Nov 4, 2022

@swift-ci Please smoke test

@xymus xymus requested review from tshortli and elsh November 4, 2022 19:36
@xymus xymus merged commit e550944 into swiftlang:main Nov 7, 2022
@xymus xymus deleted the module-alias-disambiguate branch November 7, 2022 16:46
@xymus
Copy link
Contributor Author

xymus commented Nov 7, 2022

I'll have to do more work on this feature so I'll keep an eye on review comments and will apply them in the next PR.

Copy link
Contributor

@tshortli tshortli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

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