Skip to content

fix/issue 2993 - #3020

Draft
jurgenvinju wants to merge 6 commits into
mainfrom
fix/issue-2993
Draft

jurgenvinju wants to merge 6 commits into
mainfrom
fix/issue-2993

Conversation

@jurgenvinju

@jurgenvinju jurgenvinju commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

The last change makes it possible to type-check visit statically, because the runtime guarantees to not make errors.

@PaulKlint and I talked this over; to see what consequences there are for the (static) semantics of visit; this is the smallest change that:

  • (a) makes visit statically checkable by checking each case for type-preservation
  • (b) guarantees to never produce type-incorrect constructor applications at run-time.
  • (c) does not influence run-time efficiency unless in the very rare case that two constructors/functions for the same type with the same name exist and one of them is not in declaration scope. Still it is faster than the original code.
  • (d) allows for type-preservation with sub-typing, so we can increase a list[void] to a list[int], and the result will only be used if its fits in the unchanged/changed parent constructor.

@codecov

codecov Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 57.14286% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 46%. Comparing base (4d10ecd) to head (88fb15f).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
.../org/rascalmpl/interpreter/TraversalEvaluator.java 57% 2 Missing and 4 partials ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##              main   #3020   +/-   ##
=======================================
  Coverage       46%     46%           
- Complexity    6933    6940    +7     
=======================================
  Files          851     851           
  Lines        69376   69371    -5     
  Branches     10110   10114    +4     
=======================================
+ Hits         32178   32194   +16     
+ Misses       34764   34741   -23     
- Partials      2434    2436    +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.

…ADT constructors with types that do not match with the currently rewritten constructor (always one without a declaration in the current scope)
@sonarqubecloud

Copy link
Copy Markdown

try {
assert args != null;
QualifiedName n = Names.toQualifiedName(cons.getType().getName(), cons.getName(), null);
// TODO: lookup the function in the current scope and memo it for during the visit, also its absence.

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.

When is this Todo suppose to be done? If not in this PR, can we explain why we're not doing this yet?

@sungshik sungshik mentioned this pull request Nov 30, 2026

This branch has not been deployed

No deployments
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.

UnexpectedType error during visit when subject ADT (defined in multiple modules) is only partially visible

2 participants