-
Notifications
You must be signed in to change notification settings - Fork 79
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
core: Improve error message for unknown block successor #3762
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -100,7 +100,7 @@ def __init__( | |
super().__init__(ParserState(MLIRLexer(Input(input, name))), ctx) | ||
self.ssa_values = dict() | ||
self.blocks = dict() | ||
self.forward_block_references = dict() | ||
self.forward_block_references = defaultdict(list) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What does this change do? |
||
self.forward_ssa_references = dict() | ||
|
||
def parse_module(self, allow_implicit_module: bool = True) -> ModuleOp: | ||
|
@@ -145,7 +145,7 @@ def parse_module(self, allow_implicit_module: bool = True) -> ModuleOp: | |
value_names = ", ".join( | ||
"%" + name for name in self.forward_ssa_references.keys() | ||
) | ||
if len(self.forward_block_references.keys()) > 1: | ||
if len(self.forward_ssa_references.keys()) > 1: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks like a separate change but I don't mind including it here. |
||
self.raise_error(f"values {value_names} were used but not defined") | ||
else: | ||
self.raise_error(f"value {value_names} was used but not defined") | ||
|
@@ -564,7 +564,7 @@ def parse_optional_region( | |
region.add_block(block) | ||
|
||
# Finally, check that all forward block references have been resolved. | ||
if len(self.forward_block_references) > 0: | ||
if self.forward_block_references: | ||
pos = self.lexer.pos | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should probably be |
||
raise MultipleSpansParseError( | ||
Span(pos, pos + 1, self.lexer.input), | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"span" is parser terminology, no? Same with "unknown location".
The block name could be in quotes - maybe have a look how we do it in other block references within error messages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This error message is definitely not correct.