Revive TypeWriter#464
Merged
Merged
Conversation
Conflicts: src/compiler/checker.ts
Contributor
Author
There was a problem hiding this comment.
Check if this name is the parent's name.
Contributor
There was a problem hiding this comment.
So i think this code is fine. But here's my concern. It highly depends on the shape of the AST, and ensuring htat hte only identiier a type declaration can point at is the 'name' portion. This may not always be true.
IMO, you should add one additional check that (name.parent).name == identifier.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change adds back the typeWriter pass on all the compiler tests. The typeWriter walks the tree and prints the types of all expressions and nodes (it actually tries to pick the same node kinds as the old typeWriter). It gets the type of every node, using the getTypeOfNode function (new in this review). If it gets unknownType, it just prints the name of the node. That fallback is mostly used for namespaces, which have no types associated with them (again, we want to resemble the old type writer as much as possible for now).
I've added some publicly exposed functions to the checker. The main one is getTypeOfNode, but I have altered and removed a few others.
Some tests crashed when run with typeWriter. I have opened bugs for these.
We still have a bunch of work to do to make the new type baselines look like the old ones in order to do a baseline comparison.