Open
Conversation
9 tasks
Contributor
There was a problem hiding this comment.
Pull request overview
This PR removes the isElisionBlocked function from the import elision transformer. The function previously prevented import/export elision for statements modified by custom before transformers. Since the codebase no longer uses before transformers and the type eraser (which can touch imports) now runs before the import elider, this check is obsolete and was blocking legitimate elision.
Changes:
- Removed the
isElisionBlockedfunction and all its logic - Simplified import/export elision code paths by removing conditional blocking checks
- Updated test baselines to reflect that type-only imports are now properly elided
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| internal/transformers/tstransforms/importelision.go | Removed isElisionBlocked function and simplified elision logic by removing blocking checks |
| testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmitErrors1(module=*).js | Updated baselines showing type-only imports are now properly elided across different module modes |
| testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmitErrors(module=*).js | Updated baselines showing type-only imports are now properly elided for import attributes syntax |
| testdata/baselines/reference/submodule/conformance/importSpecifiers1.js | Updated baseline showing a type-only import is now elided instead of preserved |
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.
Fixes #2636
Alternative to #2646 (which is this PR but for one call)
Reading the original code's comment:
The purpose of this function is to not elide an import if it had been touched by a custom before transformer.
In Strada, this was fine. The ts transformer went first and did everything under the sun; import elision, type removal, etc.
But now, we split things up. The type eraser runs before the import elider, and the eraser can touch imports (and even elide them itself). This puts us directly in the path of
isElisionBlocked.We don't have before transformers, and it's nontrivial to attempt to mush these transformers back together again.
I think it's probably okay to just delete
isElisionBlockedand address this later if we find it to be a problem.Funnily, if you delete
isElisionBlockedfrom Strada, nothing breaks!