Repository navigation
Parser error type identifier - #4878
Jon (jbondc) wants to merge 7 commits into
Conversation
There was a problem hiding this comment.
predicateNode
|
Jon (@jbondc) I don't think this is the correct approach for the original bug. As Cyrus Najmabadi (@CyrusNajmabadi) pointed out, I think we'd be better off parsing the type and erroring afterwards. Additionally, I think we should be reporting the specific errors suggested. |
|
Used this technique to avoid |
|
Going to reference #3003 to this, having the ability to improve error messages seems valuable too. |
|
Daniel Rosenwasser (@DanielRosenwasser) is performance the primary concern? Don't mind revisiting the approach. |
|
Would be nice to have a more generalized solution to parser error recovery, #5173, #4260 Do think the approach I took was a step in the right direction: |
|
It seems like there should be a much easier fix here. Namely, after parsing out the I've very hesitant about having any sort of parser flags. Esp. around errors. |
|
Cyrus Najmabadi (@CyrusNajmabadi) I'll try something else. Is there any reason a missing node doesn't have a flag? That seems useful. It could be a single check here: |
|
Yes. It was very intentional. Such a flag would be redundant with existing information already on the node. Redundant information in a tree is very concerning to me as it now means you have to ensure that they must stay in sync 100% of the time. If you screw that up then you get inconsistencies that make everything difficult. Such a concern is not hypothetical either. Both the original TS parser and the Roslyn parsers suffered from this problem. They had redundant forms of information that weren't always kept in sync properly. And people used different mechanisms to grok out that information later in the pipeline, leading to all sorts of subtle and annoying bugs. I'd far prefer to have one uniform way to encode if a node is missing, and one way to check for it (through a function which everyone calls). |
Add a 'NodeFlags.Missing' to easily check for missing node.
Better error on bad type predicate.
ba90e05 to
1868d43
Compare
|
Cyrus Najmabadi (@CyrusNajmabadi) Refactored using a Let me know what you think |
There was a problem hiding this comment.
This is a regression.
|
Jon (@jbondc) I'm not a fan of this approach. As mentioned earlier, I don't believe the flag I appropriate. It's now confusing to users if they should check that flag or use the function to test if a node is missing. Second, this adds a lot of complexity into the parser. A much simpler solution would be to just make parsing more lenient, and then check for invalid precedence later on during our normal syntactic checks. |
|
As Cyrus Najmabadi (@CyrusNajmabadi) explained, this is the correct approach. there has not been much activity here either, so closing. please resubmit with the outlined approach. |
|
k bye |

This improves parsing an invalid type identifier #4067
Was tricky, added a
ParserContextFlags.NoErrorflag to disable errors on parsing, then check for missing node(s) to improve the error(s).