Repository navigation
Fix start&top implementation in typechecker - #2551
DavyLandman wants to merge 18 commits into
Conversation
This reverts commit 8655ee2.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2551 +/- ##
=======================================
- Coverage 46% 46% -1%
- Complexity 6933 6937 +4
=======================================
Files 852 852
Lines 69363 69363
Branches 10112 10112
=======================================
- Hits 32173 32171 -2
- Misses 34756 34760 +4
+ Partials 2434 2432 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
jurgenvinju
left a comment
There was a problem hiding this comment.
Looks good. Needs an integration test.
|
|
@jurgenvinju this is your own code ;) I merely did some git cooking to extract it from a different PR. |
|
@PaulKlint should we use typepal's "predefine" functionality instead of constructing an artificial field location for "top"? Same for the entire start rule. Should we use predefine for that as well? |
70579b4 to
1a8c413
Compare
|
This is a false negative by the current Rascal type-checker. The `.top` field only exists on implicitly generated start non-terminals like `start[Program]`. Refactored with semantic equivalence. But the rule for `start[Program]` is probably superfluous due to the recursive nature (automatic recursion) of `collect`. Doing this fix now because the PR ( usethesource/rascal#2551 ) that fixes many false positives and false negatives with respect to start symbols will trigger a true positive here soon.
PaulKlint
left a comment
There was a problem hiding this comment.
Overall looks good ans simplifies things. I have a few comments:
- There was code duplication introduced in
CollectSyntaxDeclaration. Moved this toComputeType - A test in
ChangeAndHashScenarioswas changed. I disagree. It is also related to errors in integration tests (see below) - In some places the indentation was namgled (immature formatter?), I have restored it manually.
The following errors in the integration tests should be fixed first:
[ERROR] src/org/rascalmpl/library/lang/rascal/tests/concrete/Syntax1.rsc:0010:000: Duplicate declaration of nonterminal `start(aadt("A",[],contextFreeSyntax()),contextFreeSyntax())`
* src/org/rascalmpl/library/lang/rascal/tests/concrete/Syntax1.rsc:0009:000: First declaration of nonterminal `start(aadt("A",[],contextFreeSyntax()),contextFreeSyntax())`
* src/org/rascalmpl/library/lang/rascal/tests/concrete/Syntax1.rsc:0010:000: Second declaration of nonterminal `start(aadt("A",[],contextFreeSyntax()),contextFreeSyntax())`
[ERROR] src/org/rascalmpl/library/lang/rascal/tests/concrete/Syntax1.rsc: Duplicate declaration of production ``
* src/org/rascalmpl/library/lang/rascal/tests/concrete/Syntax1.rsc: First declaration of production ``
* src/org/rascalmpl/library/lang/rascal/tests/concrete/Syntax1.rsc: Second declaration of production ``
[ERROR] src/org/rascalmpl/library/lang/rascal/tests/concrete/Syntax1.rsc: Duplicate declaration of field `top`
* src/org/rascalmpl/library/lang/rascal/tests/concrete/Syntax1.rsc: First declaration of field `top`
* src/org/rascalmpl/library/lang/rascal/tests/concrete/Syntax1.rsc: Second declaration of field `top`
[ERROR] src/org/rascalmpl/library/lang/rascal/tests/concrete/Syntax1.rsc:0013:000: Duplicate declaration of nonterminal `start(aadt("B",[],contextFreeSyntax()),contextFreeSyntax())`
* src/org/rascalmpl/library/lang/rascal/tests/concrete/Syntax1.rsc:0012:000: First declaration of nonterminal `start(aadt("B",[],contextFreeSyntax()),contextFreeSyntax())`
* src/org/rascalmpl/library/lang/rascal/tests/concrete/Syntax1.rsc:0013:000: Second declaration of nonterminal `start(aadt("B",[],contextFreeSyntax()),contextFreeSyntax())`
[ERROR] src/org/rascalmpl/library/lang/rascal/tests/concrete/Syntax1.rsc: Duplicate declaration of production ``
* src/org/rascalmpl/library/lang/rascal/tests/concrete/Syntax1.rsc: First declaration of production ``
* src/org/rascalmpl/library/lang/rascal/tests/concrete/Syntax1.rsc: Second declaration of production ``
[ERROR] src/org/rascalmpl/library/lang/rascal/tests/concrete/Syntax1.rsc: Duplicate declaration of field `top`
* src/org/rascalmpl/library/lang/rascal/tests/concrete/Syntax1.rsc: First declaration of field `top`
* src/org/rascalmpl/library/lang/rascal/tests/concrete/Syntax1.rsc: Second declaration of field `top`
|
|
Progress ... down to two errors in integration tests: |



This PR continues the work in #2499 (that was merged to main a bit too soon) to fix #2496
start[X]andX(inasubtype,alub,aglb).topcontextFreeSyntaxrole is expected by adding arolefield to thestartATypesyntaxrule forXthat has astartmodifier:start[X] = X;start[X] = X top;start[X] = L X L;isStart*andgetStart*that were used for detecting the old special casesTogether these changes solve a small number of known issues with start symbols, and a larger number of previously undetected issues.