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

Add capture checking attributes to TASTy #19033

Merged
merged 1 commit into from
Nov 28, 2023

Conversation

nicolasstucki
Copy link
Contributor

@nicolasstucki nicolasstucki commented Nov 23, 2023

Replace @CaptureChecked and @WithPureFuns with TASTy attributes.

@nicolasstucki nicolasstucki self-assigned this Nov 23, 2023
@nicolasstucki nicolasstucki force-pushed the add-cc-attibutes branch 4 times, most recently from 759e518 to f71121b Compare November 27, 2023 08:33
nicolasstucki added a commit that referenced this pull request Nov 27, 2023
We generalize the internal encoding of `Attributes` to be a list of
tags. Then we add add helper methods to have simpler ways to interact
with this abstraction using booleans. This implies that the
pickling/unpickling can be agnostic of the semantics of each tag.
Therefore reducing the number of places that need to be updated when we
add a new tag.

Useful for #19074, #19033, and #18948.
nicolasstucki added a commit to dotty-staging/dotty that referenced this pull request Nov 27, 2023
We generalize the internal encoding of `Attributes` to be a list of
tags. Then we add add helper methods to have simpler ways to interact
with this abstraction using booleans. This implies that the
pickling/unpickling can be agnostic of the semantics of each tag.
Therefore reducing the number of places that need to be updated when we
add a new tag.

Useful for scala#19074, scala#19033, and scala#18948.
@nicolasstucki nicolasstucki marked this pull request as ready for review November 27, 2023 14:04
Copy link
Contributor

@odersky odersky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice cleanup!

@odersky odersky merged commit ab4f0e2 into scala:main Nov 28, 2023
19 checks passed
@odersky odersky deleted the add-cc-attibutes branch November 28, 2023 10:15
@Kordyjan Kordyjan added this to the 3.4.0 milestone Dec 20, 2023
nicolasstucki added a commit that referenced this pull request Jan 3, 2024
We can override the sources of the standard library with cc annotation
in this project and generate a TASTy version of the standard library.

Usage:
```
sbt> set ThisBuild/Build.scala2Library := Build.Scala2LibraryCCTasty
sbt> scala3-bootstrapped/testCompilation
sbt> scala3-bootstrapped/test
sbt> scala3-bootstrapped/run ...
```

```
sbt> scala2-library-cc/run diff
sbt> scala2-library-cc/run diff scala/Option.scala
sbt> scala2-library-cc/run diff scala/collection/immutable
```

### Current limitations

#### Empty self types in library
We need to override `Function1` and `PartialFunction` to remove their
empty self type. These cause some problem with capture checking. We need
to fix these cases. I will open an issue once we have a way to reproduce
it with this PR.

#### Cannot use the TASTy jar yet
There is a bug when we try to class load the captured checked library
from TASTy. These are due to some cyclic reference while unpickling the
TASTy.

<del>The current theory is that this due to the CC annotations in the
top-level classes.
If this is the case, we can fix this issue by adding these language
features as TASTy attributes (see #19033).</del>
This was wrong or only part of the problems. The current issue can be
reproduced with #19115.
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.

None yet

3 participants