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

Improve blame error part 3 #142

Merged
merged 4 commits into from Sep 30, 2020
Merged

Improve blame error part 3 #142

merged 4 commits into from Sep 30, 2020

Conversation

yannham
Copy link
Member

@yannham yannham commented Sep 15, 2020

Depends on #141. Follow-up of #140 and #141. Filter and show the callstack when an higher-order contract fails.

what it does

  • process the call stack to group elements into atomic calls and filter out calls to standard contracts
  • show the callstack when a higher-order blame error occurs

limitations
An unfortunate limitation is that codespan does not preserve the original order of labels. That is, if we just show the successive calls as labels of the original error, they will be re-ordered and possibly fused depending on their respective position in the source, losing the temporal information, as in the following example:

callstack-bad-order

Here, the calls happen in the order (1)-(2)-(3), but are displayed in the order (2)-(3)-(1).

Possible fixes are:

  1. Use a distinct diagnostic to display each call of the callstack.
  2. Switch to a different error reporting library which gives some control on the order of error message.
  3. Have a separate rendering engine for the call stack, but this means more or less reimplementing half of codespan.
  4. Hack into codespan to make it possible to preserve the ordering of labels.

I went for solution 1. for the time being, which requires minimal changes while the others have heavy implications. It gives reasonable results, although there are these annoying "note:" headers, as showed below:

callstack-ex-1

callstack-ex-2

@yannham yannham changed the title Improve blame error, part 3 Improve blame error part 3 Sep 15, 2020
Base automatically changed from feature/improve-blame-errors-2 to master September 16, 2020 10:03
@dpulls
Copy link

dpulls bot commented Sep 16, 2020

🎉 All dependencies have been resolved !

@yannham yannham force-pushed the feature/improve-blame-errors-3 branch 2 times, most recently from 0779d77 to fa10d76 Compare September 16, 2020 14:27
@yannham yannham marked this pull request as ready for review September 16, 2020 14:27
Copy link
Member

@aspiwack aspiwack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The “note” label is not that bad, if not completely obvious.

I don't know whether the stack filtering is the right way to produce a useful call stack (it seems to give decent results at least). But the documentation is very good, so it'll be clear how to alter it in the future, should the need arise.

@yannham yannham force-pushed the feature/improve-blame-errors-3 branch from e3e497b to c602e07 Compare September 30, 2020 15:06
@yannham yannham merged commit 7e1b681 into master Sep 30, 2020
@yannham yannham deleted the feature/improve-blame-errors-3 branch September 30, 2020 15:13
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.

None yet

2 participants