Split heritage clause expression and type nodes - #4797
Draft
Jake Bailey (jakebailey) wants to merge 4 commits into
Draft
Split heritage clause expression and type nodes#4797Jake Bailey (jakebailey) wants to merge 4 commits into
Jake Bailey (jakebailey) wants to merge 4 commits into
Conversation
Member
Author
|
TypeScript Bot (@typescript-bot) perf test this faster |
|
I guess this reinforces that there really are two cases here, which I hadn't really thought about previously, seems like a good idea! |
| assert.strictEqual(interfaceDecl.heritageClauses?.[0].types[0].kind, SyntaxKind.TypeReference); | ||
| } | ||
| finally { | ||
| api.close(); |
There was a problem hiding this comment.
This showing up all over in the unit tests makes me wonder if API ought to have a Symbol.dispose method so the tests can do using api = spawnAPI(...) and avoid this
|
Jake Bailey (@jakebailey) Here they are:
tscComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
Developer Information: |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| p.emitToken(node.Token, node.Pos(), WriteKindKeyword, node.AsNode()) | ||
| p.writeSpace() | ||
| p.emitList((*Printer).emitExpressionWithTypeArgumentsNode, node.AsNode(), node.Types, LFHeritageClauseTypes) | ||
| p.emitList((*Printer).emitTypeNodeOutsideExtends, node.AsNode(), node.Types, LFHeritageClauseTypes) |
There was a problem hiding this comment.
This reads kind of suspiciously both before and after, doesn’t it? Because an ExpressionWithTypeArguments is not a type node, and a type reference is not an ExpressionWithTypeArguments?
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Gerrit Birkeland (@Gerrit0) mentioned on Discord that heritage clauses are expressions with type args, but that those are not marked as type nodes.
While we could probably restore the brand, that got me thinking whether or not we could actually just have two different nodes here depending on whether or not it's type space or not.
I threw copilot at it to see if it could make the change and how bad it'd be.
I actually don't think that this is that bad at all,
and does (IIRC) resolve a previous conversation we had about how it was weird to make the emitter handle this?(no, that was something else, the use of ExprWithTypeArgs for hovers)