-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix apply rule #24273
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
Fix apply rule #24273
Conversation
bracevac
left a comment
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
| else eagerHeadPrependIterator(it.next().iterator)(eagerHeadConcatIterators(it)) | ||
| if !it.hasNext then Empty | ||
| else | ||
| caps.unsafe.unsafeDiscardUses: |
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.
That way, this escape hatch becomes unnecessary.
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.
But I believe it's still good to have the escape hatch, in general.
3f63308 to
b1aac05
Compare
|
This caused one regression in the standard library, here: Previously the access to This also did not compile since it claimed that the |
Is this where we should annotate |
|
We don't have |
b1aac05 to
33059ca
Compare
This was already the case for the select rule optimization in recheckSelection
but was missing for the corresponding rule for applications.
This caused one regression in the standard library, here:
```
private def eagerHeadConcatIterators[A](it: Iterator[collection.Iterable[A]^]^): LazyListIterable[A]^{it} =
if !it.hasNext then Empty
else
eagerHeadPrependIterator
(it.next().iterator)
(eagerHeadConcatIterators(it))
```
Previously the access to `it.next()` was considered to have type `it` by applying the apply rule
incorrectly. It should be `it*`. This means we now have `it*` instead of `it` in the result type
and we also have an illegal use of `it*` leaking outside `eagerHeadConcatIterators`. The second
problem was fixed by adding an unsafe escape hatch `unsafeDiscardUses` that suppressed use recording.
This leads to:
```
private def eagerHeadConcatIterators[A](it: Iterator[collection.Iterable[A]^]^): LazyListIterable[A]^{it*} =
if !it.hasNext then Empty
else
eagerHeadPrependIterator
(caps.unsafe.unsafeDiscardUses(it.next()).iterator)
(eagerHeadConcatIterators(it))
```
This also did not compile since it claimed that the `it @reachCapability` was not a legal element of a capture set.
The root cause was that we forced some definitions already in parser, which can lead to confusion when compiling the
standard library itself. We now refrain from doing that and build the references to these annotations as untyped
trees all the way down.
33059ca to
7bf957d
Compare
Don't perform the apply rule optimization under boxing
This was already the case for the select rule optimization in recheckSelection
but was missing for the corresponding rule for applications.