Update extension methods specification for prefix imports.#672
Merged
Conversation
Allow extensions imported with a prefix to be accessible for implicit invocation, but make them less specific than any extension imported without a prefix.
This was referenced Nov 11, 2019
leafpetersen
approved these changes
Nov 12, 2019
|
|
||
| An extension is *accessible* for an expression if it is declared in the current library, or if there is a non-deferred `import` declaration in the current library of a library with the extension in its export scope, where the name of the extension is not private and it is not hidden by a `hide` or `show` modifier of the import. _This includes (non-deferred) imports with a prefix._ | ||
|
|
||
| It is a *compile-time error* if a deferred import declaration imports a library with an extension declaration in its export scope, unless all such extensions are hidden by `show` or `hide` modifiers on the deferred import. *This is a temporary restriction ensuring that no extensions are introduced using deferred imports, and it allows us to later introduce any semantics for such extensions without affecting existing code*. |
Member
There was a problem hiding this comment.
hide only. show is an error as well.
Member
There was a problem hiding this comment.
Ah, I understand, you mean that the extension is hidden by a show of something else. I found this confusing though. Consider re-phrasing?
Member
Author
There was a problem hiding this comment.
Or will do, I actually updated the paragraph below instead.
| 3. *T<sub>1</sub>* is a subtype of of *T<sub>2</sub>* and either | ||
| 4. not vice versa, or | ||
| 5. the instantiate-to-bounds `on` type of `E1` is a subtype of the instantiate-to-bounds `on` type of `E2` and not vice versa. | ||
| 1. The `E2` extension is only accessible from imports with a prefix and `E1` not, or |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Allow extensions imported with a prefix to be accessible for implicit invocation, but make them less specific than any extension imported without a prefix.