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

feat/error recovery robust field projection #2073

Draft
wants to merge 5 commits into
base: feat/error-recovery
Choose a base branch
from

Conversation

jurgenvinju
Copy link
Member

@jurgenvinju jurgenvinju commented Nov 8, 2024

This experiment makes parse tree instances (ITree's in Java) which happen to have error productions robust again field projection (in the interpreter)

  • if the field is before the error "dot", it just works as normal field projection
  • if the field is on or beyond the error dot, then we return a fresh error tree of the right type but without content.

Of course further field projection on such a stub would not work anymore, because there is no more production to work with. So this gives only one layer of robustness. A future version of this could recursively keep returning empty error stubs, but I don't know how to obtain the right type for those trees from the interpreter.

The questions are:

  • does this help to remove many scattered hasError checks?
  • is this predictable and understandable behavior for the field projection semantics?
  • @PaulKlint compiled version of tree field projection {sh,w,c}ould also have this semantics?
  • what did I forget?

At the very least field projection should work for fields which are before the dot. The rest is open for discussion I think.

Copy link

codecov bot commented Nov 8, 2024

Codecov Report

Attention: Patch coverage is 11.90476% with 37 lines in your changes missing coverage. Please review.

Project coverage is 49%. Comparing base (415773f) to head (e964a65).
Report is 20 commits behind head on feat/error-recovery.

Files with missing lines Patch % Lines
...c/org/rascalmpl/values/parsetrees/TreeAdapter.java 0% 23 Missing ⚠️
...almpl/interpreter/result/ConcreteSyntaxResult.java 0% 10 Missing ⚠️
...rascalmpl/values/parsetrees/ProductionAdapter.java 55% 3 Missing and 1 partial ⚠️
Additional details and impacted files
@@                  Coverage Diff                  @@
##             feat/error-recovery   #2073   +/-   ##
=====================================================
- Coverage                     49%     49%   -1%     
+ Complexity                  6605    6602    -3     
=====================================================
  Files                        685     685           
  Lines                      61148   61187   +39     
  Branches                    8850    8862   +12     
=====================================================
+ Hits                       30239   30243    +4     
- Misses                     28706   28740   +34     
- Partials                    2203    2204    +1     

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

@jurgenvinju jurgenvinju changed the base branch from main to feat/error-recovery November 8, 2024 15:47
@jurgenvinju jurgenvinju self-assigned this Nov 8, 2024
@jurgenvinju
Copy link
Member Author

This PR now also covers has, is, setLabeledField on error trees next to the getLabeledField it was originally for.

  • Some off-by-one errors wrt the dot to look out for
  • this needs a lot of tests

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