Skip to content

Module selectors (formerly module qualifiers) #28834

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

Closed
wants to merge 21 commits into from

Conversation

beccadax
Copy link
Contributor

@beccadax beccadax commented Dec 17, 2019

This pull request begins to implement "module selectors", which allow references to declarations to be unambiguously prefixed with a module they can be found through:

class MyClass: ObjectiveC::NSObject {}  // OK, ObjectiveC defines NSObject
class MyClass: Foundation::NSObject {}  // OK, Foundation re-exports NSObject
class MyClass: Swift::NSObject {}       // error, Swift does not re-export or define NSObject
class MyClass: MyModule::NSObject {}    // error, MyModule does not re-export or define NSObject

This PR parses module selectors and partially implements lookup and diagnostics for them. The new functionality is hidden behind an -enable-experimental-module-selector frontend flag. There is one diagnostic regression with that flag enabled, but I've made sure that it keeps working when the diagnostic is disabled.

I will need to switch to other tasks soon, so I plan to merge this work in its current incomplete state to keep it from rotting in a branch.

Makes progress on rdar://problem/19481048.

@beccadax
Copy link
Contributor Author

I’m unfortunately running out of time to work on this, so I’ll need clean it up and land it behind a feature flag to keep it from rotting.

@beccadax beccadax changed the title Scope selectors (formerly module qualifiers) Module selectors (formerly module qualifiers) Dec 20, 2019
This breaks some diagnostics in expr/primary/unqualified_name.swift; I’ll continue adding the feature and then revisit these to see how I can support them.
This is a first cut at how imports ought to adopt module selectors.
It will soon need to allocate sometimes.
@beccadax beccadax force-pushed the mod-squad branch 2 times, most recently from 4de501a to 04f95bf Compare December 21, 2019 03:08
@beccadax
Copy link
Contributor Author

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - beda9d1ef919d7c43fc2030b404641b3d80bc461

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - beda9d1ef919d7c43fc2030b404641b3d80bc461

@beccadax beccadax marked this pull request as ready for review December 21, 2019 04:31
@beccadax
Copy link
Contributor Author

beccadax commented Jan 2, 2020

@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented Jan 2, 2020

Build failed
Swift Test Linux Platform
Git Sha - 04f95bf3da208e0627cb695eaa71b88fb072b764

@swift-ci
Copy link
Contributor

swift-ci commented Jan 2, 2020

Build failed
Swift Test OS X Platform
Git Sha - 04f95bf3da208e0627cb695eaa71b88fb072b764

The history of this PR is actually a gigantic fiction and so some of the fix-it source locations are incorrect. Sorry about that.
@beccadax
Copy link
Contributor Author

beccadax commented Jan 2, 2020

#28936 broke this branch; force-pushed to correct the code.

@beccadax
Copy link
Contributor Author

beccadax commented Jan 2, 2020

@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented Jan 2, 2020

Build failed
Swift Test OS X Platform
Git Sha - 04f95bf3da208e0627cb695eaa71b88fb072b764

@swift-ci
Copy link
Contributor

swift-ci commented Jan 2, 2020

Build failed
Swift Test Linux Platform
Git Sha - 04f95bf3da208e0627cb695eaa71b88fb072b764

@shahmishal
Copy link
Member

Please update the base branch to main by Oct 5th otherwise the pull request will be closed automatically.

  • How to change the base branch: (Link)
  • More detail about the branch update: (Link)

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.

3 participants