Interactive: fix expression locations#717
Conversation
…closes #689) Ideally we would have a choice and update edge locations instead of nodes, but they cannot be referenced.
vesalvojdani
left a comment
There was a problem hiding this comment.
This works on the examples I tried. I'm not sure about the TODOs. We don't have tests for assertion generation, do we?
No. I'll leave it for anyone working on assert generation to figure out in the future, what is intended. Because that's more of an AST transformation and deals with |
Closes #689.
This is only a problem on
interactivedue to #533 only being there.The ideal solution would be to have
UpdateCilalso update expression locations (not just one location for each statement), but that requires a lot more work to distinguish the statements/instructions and store multiple locations for some.Also, since there's no way to identify specific CFG edges (unlike nodes, which have IDs from either statements or the function), there's no easy way to just update the edge locations incrementally either. PR #689 and this make edge locations largely redundant (at least for messages, maybe something uses them non-incrementally directly).
Therefore this PR just contains a refinement of @vesalvojdani's original fix: simply use expression locations for everything.
This makes it impossible to get and warn about an entire
if/while/switchstatement, rather than just its expression, but I don't remember any case where we want to do that. If that turns up, a more involved fix is necessary to distinguish the two.