-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Introduce Maybe Capabilities #19500
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
Introduce Maybe Capabilities #19500
Conversation
9d67a9e
to
fcc77a0
Compare
* cannot be propagated between sets. If `a <: b` and `a` acquires `x?` then | ||
* `x` is propagated to `b` as a conservative approximation. | ||
* | ||
* Maybe capabilities should only arise for caoture sets that appear in invariant |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: "capture"
* | ||
* Array[C^{x?}] | ||
* | ||
* should be morally equivaelent to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: "equivalent"
@dwijnand Mima rejects the changes, even though I did add the suggested problemFilter. Can you check, please? |
"in other version" implies (normally) forwards compat, so I think you might need to move the change to |
947c64e
to
6ee2aaa
Compare
@dwijnand I now added to either only to Forward or Forward and Backward, still with the same results. Can you try it out, or maybe @nicolasstucki knows something? |
474ac9e
to
50597e7
Compare
@dwijnand @nicolasstucki I could not make MimaFilters work. Maybe we simply cannot add any class during a point release, even though it is compiler-internal? I now avoid creating the class entirely and use a synthesized symbol instead. It's more complicated, though, so it would be good to know the answer to this question for the future: Is there a way to add in a point release a file to the scala library that's supposed to be only used by the scala compiler? |
I haven't been following what's been done for and around LTS. I think @nicolasstucki did it. |
Avoid forming an intersection when selecting the apply method of a dependent function type.
Introduce maybe capabilities x? to handle the case where a capture set appears invariantly in its surrounding type. Maybe capabilities are similar to TypeBounds types, but restricted to capture sets. For instance, Array[C^{x?}] should be morally equivaelent to Array[_ >: C^{} <: C^{x}] but it has fewer issues with type inference.
Most hacks using `asInstanceOf` or `???` are no longer necessary.
It's used only during the capture checking phase, cannot appear in source or Tasty. So it's best contained as a synthetic symbol created directly by the compiler.
Detected manually, even though the test as a whole succeeded
50597e7
to
4cd72b7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@@ -422,9 +444,14 @@ object ReachCapabilityApply: | |||
/** An extractor for `ref @annotation.internal.reachCapability`, which is used to express |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The documentation is out-dated
We do not have a way to encode that. We throw all those into |
There's also |
Introduce maybe capabilities x? to handle the case where a capture set
appears invariantly in its surrounding type.
Maybe capabilities are similar to TypeBounds types, but
restricted to capture sets. For instance,
should be morally equivaelent to
but it has fewer issues with type inference.