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

Don't include redundant locs in wf-errors #1451

Open
wants to merge 1 commit into
base: horizon
Choose a base branch
from

Conversation

BenMusch
Copy link
Contributor

Fixes #1436

No tests included because the test suite seems to check that C.wf-errs are thrown, but not their specific contents. Happy to find a way include tests if y'all want them

Example of an error message now:

Well-formedness: (at file:///Users/ben/src/pyret-lang/build/t.arr:2:2-2:9) A standalone variable name probably isn't intentional.

cc @blerner

@blerner
Copy link
Member

blerner commented May 24, 2019

You missed the other sentence in the bug report, though: "There's a bunch of these ED.cmcode(self.loc) expressions in many of the wf-errors' render-reason methods." Take a quick look to spot other redundant ones, if you can.

@BenMusch
Copy link
Contributor Author

Will do. Is there an easy way to test render-fancy-reason? I noticed some that appear redundant there, but can't tell if they're potentially used to parse the errors in the UI, so I held off from changing those

@blerner
Copy link
Member

blerner commented May 24, 2019 via email

@BenMusch
Copy link
Contributor Author

BenMusch commented May 24, 2019

As far as I can tell, all of the remaining duplicate loc's are in the render-fancy-reason method, so I tested code.pyret.org locally with the duplicate loc's removed and it seems to change the behavior substantially. A local version running my pyret is on the left, production version with both loc's is on the right:

Screen Shot 2019-05-24 at 1 40 25 PM

Maybe it's worth keeping the duplicate locs since it seems like it makes the UI nicer? At least in the context of larger programs, the code block display seems handy

@jswrenn
Copy link
Member

jswrenn commented May 24, 2019

Ideally we would use cmcode in the render-reason methods, too, and the CLI would display code snippets there too. Unfortunately, CLI error display rendering system doesn't any way to render snippets and it didn't seem trivial to add last time I looked into it, iirc.

In the absence of such a mechanism, any appearance of cmcode in render-reason (but not render-fancy-reason) should be regarded as a bug.

@safwansamsudeen
Copy link

Why wasn't this merged?

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.

Well-formed errors print redundant srclocs on the command line
4 participants