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

ProgramBuilder.printDiagnostics seems to have archaic, error-prone code #216

Closed
georgejecook opened this issue Oct 14, 2020 · 2 comments
Closed
Labels
bug Something isn't working

Comments

@georgejecook
Copy link
Contributor

this code in printDiagnostics seems wrong:

let fileText = await util.getFileContents(pathAbsolute);

  1. It does not take into account the files current contents, if they are manipulated in some way
  2. it does not load the contents from a file resolver
  3. in the case of a generated file, it causes a crash as the source is not found, despite the file's contents, lines and ast all being valid..

I workaround this for now with a try catch; but I suspect the fix will be in getFileContents to get the current contents of the file, or fallback to disk, as a last resort.

My fix:
image

@georgejecook georgejecook added the bug Something isn't working label Oct 14, 2020
@TwitchBronBron
Copy link
Member

#217 fixed this, right @georgejecook ?

@TwitchBronBron
Copy link
Member

Closing due to inactivity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants