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

Make tuples be subtypes of empty interfaces (like Any). #1937

Merged
merged 2 commits into from
Jun 23, 2017

Commits on Jun 22, 2017

  1. Make tuples be subtypes of empty interfaces (like Any).

    After this commit, a tuple is considered a subtype of `Any ${cap}`
    if all of the elements of the tuple are subcaps of the cap.
    
    This is a principle of least surprise issue, as it is surprising
    that a type param constraint of `Any #any` does not behave the same
    as an unconstrained type param, with the latter accepting tuple
    type args, and the latter not doing so.
    
    Previously, there was no way to allow tuples of any cardinality
    as a type argument, while restricting what caps were allowed to
    be in those tuples (such as for the concerns of aliasing or
    sendability). For example, `class List[A]` in the `collections`
    package allowed tuples as type args, but `class List[A: Any #share]`
    in the `collections/persistent` package did not. Now they both
    allow tuple type args, and the `Any #share` constrains the type arg
    so that all tuple elements must be shareable (`val` or `tag`).
    
    Resolves #1767.
    jemc committed Jun 22, 2017
    Configuration menu
    Copy the full SHA
    7348a53 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    47a03b5 View commit details
    Browse the repository at this point in the history