Use NodeIsMissing in typeeraser.go where Strada did#3184
Open
jakebailey wants to merge 1 commit intomainfrom
Open
Use NodeIsMissing in typeeraser.go where Strada did#3184jakebailey wants to merge 1 commit intomainfrom
jakebailey wants to merge 1 commit intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aligns the Go TypeScript transformer’s handling of “missing” function-like bodies with TypeScript’s behavior by using ast.NodeIsMissing (not just nil checks), eliminating several error-recovery emit mismatches and thereby reducing baseline diffs.
Changes:
- Update
TypeEraserTransformerto treat empty-range (“missing”) bodies the same asnilbodies when deciding to elide overload-like declarations. - Refresh affected reference baselines to reflect the corrected elision behavior (removing previously-emitted stub functions / adjusting emitted module markers).
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
internal/transformers/tstransforms/typeeraser.go |
Uses ast.NodeIsMissing for constructor/method/function/accessor body checks so missing bodies created by error recovery don’t get emitted as empty stubs. |
testdata/baselines/reference/submodule/conformance/typeGuardFunctionErrors.js.diff |
Updates golden diff output after correcting erroneous stub emission. |
testdata/baselines/reference/submodule/conformance/typeGuardFunctionErrors.js |
Removes previously-emitted stub functions from the baseline output. |
testdata/baselines/reference/submodule/conformance/thisTypeInFunctionsNegative.js.diff |
Updates golden diff output after correcting erroneous stub emission. |
testdata/baselines/reference/submodule/conformance/thisTypeInFunctionsNegative.js |
Removes previously-emitted stub function from the baseline output. |
testdata/baselines/reference/submodule/conformance/parserErrantEqualsGreaterThanAfterFunction2.js.diff |
Updates golden diff output after correcting erroneous stub emission. |
testdata/baselines/reference/submodule/conformance/parserErrantEqualsGreaterThanAfterFunction2.js |
Removes previously-emitted stub function from the baseline output. |
testdata/baselines/reference/submodule/conformance/jsdocDisallowedInTypescript.js.diff |
Updates golden diff output after correcting erroneous stub emission. |
testdata/baselines/reference/submodule/conformance/jsdocDisallowedInTypescript.js |
Removes previously-emitted stub functions from the baseline output. |
testdata/baselines/reference/submodule/compiler/reachabilityChecksNoCrash1.js.diff |
Updates golden diff output after correcting erroneous stub emission and output shape. |
testdata/baselines/reference/submodule/compiler/reachabilityChecksNoCrash1.js |
Removes previously-emitted stub signature and restores/updates module marker emission (export {}) in baseline output. |
testdata/baselines/reference/submodule/compiler/parseErrorIncorrectReturnToken.js.diff |
Updates golden diff output after correcting erroneous stub emission. |
testdata/baselines/reference/submodule/compiler/parseErrorIncorrectReturnToken.js |
Removes previously-emitted object-literal stub from baseline output. |
testdata/baselines/reference/submodule/compiler/dottedModuleName.js.diff |
Updates golden diff output after correcting erroneous stub emission. |
testdata/baselines/reference/submodule/compiler/dottedModuleName.js |
Removes previously-emitted stub function assignment from baseline output. |
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 a few diffs. These are all in error cases, though.