Skip to content

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

@georgejecook

Description

@georgejecook

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions