-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Make consume a soft modifier #23755
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
base: main
Are you sure you want to change the base?
Make consume a soft modifier #23755
Conversation
c529d9a
to
b89eb41
Compare
- Split doc page into individual sub-pages - Add new material on classifiers - Revise material on scoped caps TODO - Revise material on reach capabilities - Add material on how to use the capture checker - Add material on separation checking - Check everything for completeness and accuracy Also: Add two test files named `reference-cc.scala` in neg and pos that let us try out the code on the doc pages. TODO: Complete these files so that all relevant code is there.
Files should also be listed in sidebar.yml.
Replaced hand-written intra-doc links with automatic doctool linking. Sidebar now reflects the subsection hierarchy.
Also remove redundant headings
The first paragraph of a doc page is rendered as some sort of synopsis/subtitle, which looked awkward with the current text. This change adds introduction headings, which also improves the navigation on the right-hand side of a page.
This has to be in sync with `docs/sidebar.yml`
& let the root document be an index, consistent with the style of other chapters of the reference. There is also no need to manually write the ToC with an index page.
Internally, it is still represented as an annotation
6f99bc9
to
4b8db82
Compare
@@ -995,6 +995,10 @@ class Namer { typer: Typer => | |||
end if | |||
} | |||
|
|||
private def normalizeFlags(denot: SymDenotation)(using Context): Unit = | |||
if denot.is(Method) && denot.hasAnnotation(defn.ConsumeAnnot) then | |||
denot.setFlag(Mutable) |
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.
This means that scaladoc
will always render consume update
instead of consume
.
It will have to be fixed.
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.
Yes, that would be nice to fix on scaladoc. Currently consume update
is allowed, but the update
is redundant.
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.
Currently consume update is allowed, but the update is redundant
I see what I can do to make it also a warning. The scaladoc
fix is trivial.
With the given example: ```scala import caps.consume import scala.language.experimental.captureChecking class Test extends caps.Mutable: @consume def test(@consume x: Int)(using @consume y: Int): Unit = () ``` It renders as following: <img width="1051" height="281" alt="Screenshot 2025-08-15 at 16 11 05" src="https://github.com/user-attachments/assets/022e5c58-827f-42ec-bdd7-938d019f2678" /> Related to #23755
Internally, it is still represented as an annotation.
Based on #23709