Skip to content

Fixed confusion on memo configuration - #2948

Merged
DavyLandman merged 3 commits into
mainfrom
fix/memo-tag-interpretation
Oct 23, 2026
Merged

DavyLandman merged 3 commits into
mainfrom
fix/memo-tag-interpretation

Conversation

@DavyLandman

Copy link
Copy Markdown
Member

Design

When we introduced a ADT for configuring the @memo caching feature (18e0bb7), we had to be compatible with the existing tag feature in rascal, as such we used the @<tag> = <expression> feature. So @memo=maximumSize(400) could be written by a user and get their intended behavior. But what if you wanted to combine expiration policies? Well @memo={maximumSize(400), expireAfter(minutes=2)} was the syntax. If you forgot to import the util::Memo you would get a warning on that at import time.

The problem

But this looks very much like most other tags that use the @<tag>{<string>}. So in most places people had the wrong @memo{maximumSize(400), expireAfter(minutes=2)}. Which in the interpreter while parsing these tags, we just ignored, as that was a string, and we only matched on the MemoExpireConfiguration adt.

The compiler has now implemented the memo feature in an adhoc way by regex matching on the string, so both @memo= and @memo{ work the same way, but the ADT is hard-coded in the compiler.

The fix

The interpreter has gotten a warning if the string version is used, and i've rewritten all the caches in the rascal project to use the right configuration.

The typechecker might benefit from specifically recognizing that @memo should not be a string value, but that's a new issue.

@sonarqubecloud

Copy link
Copy Markdown

@DavyLandman
DavyLandman requested a review from PaulKlint October 23, 2026 10:56
@codecov

codecov Bot commented Oct 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 33.33333% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 45%. Comparing base (7860c84) to head (35c8792).

Files with missing lines Patch % Lines
...rg/rascalmpl/interpreter/result/NamedFunction.java 33% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##              main   #2948   +/-   ##
=======================================
- Coverage       45%     45%   -1%     
+ Complexity    6815    6811    -4     
=======================================
  Files          844     844           
  Lines        68823   68826    +3     
  Branches     10038   10040    +2     
=======================================
- Hits         31432   31420   -12     
- Misses       34995   35008   +13     
- Partials      2396    2398    +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@toinehartman toinehartman left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice find!

toinehartman added a commit to usethesource/rascal-language-servers that referenced this pull request Oct 23, 2026
@DavyLandman
DavyLandman merged commit e59b9d6 into main Oct 23, 2026
8 of 9 checks passed
toinehartman added a commit to usethesource/rascal-language-servers that referenced this pull request Oct 23, 2026
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.

2 participants