Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(semantic): missing reference when export default references a type alias binding #7813

Conversation

Dunqing
Copy link
Member

@Dunqing Dunqing commented Dec 12, 2024

Fixes: #7809

ExportNamedDecalration and ExportDefaultDeclaration can reference both type binding and value, so we need to make sure the ReferenceFlags is Read | Type

@github-actions github-actions bot added A-linter Area - Linter A-semantic Area - Semantic C-bug Category - Bug labels Dec 12, 2024
Copy link
Member Author

Dunqing commented Dec 12, 2024


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@Dunqing Dunqing changed the title fix(semantic): missing reference when export default references a type alias binding fix(semantic): missing reference when export default references a type alias binding Dec 12, 2024
@Dunqing Dunqing marked this pull request as ready for review December 12, 2024 05:20
@Dunqing Dunqing requested a review from Boshen as a code owner December 12, 2024 05:20
@Dunqing Dunqing force-pushed the 12-12-fix_semantic_missing_reference_when_export_default_references_a_type_alias_binding branch from 7f80ffe to 877a83a Compare December 12, 2024 05:20
@Dunqing Dunqing changed the base branch from 12-11-refactor_transformer_handle_cwd_in_test_runner to main December 12, 2024 05:20
@Boshen Boshen added the needs-discussion Requires a discussion from the core team label Dec 12, 2024
Copy link

codspeed-hq bot commented Dec 12, 2024

CodSpeed Performance Report

Merging #7813 will degrade performances by 3.15%

Comparing 12-12-fix_semantic_missing_reference_when_export_default_references_a_type_alias_binding (7a83230) with main (8991f33)

Summary

❌ 1 regressions
✅ 28 untouched benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark main 12-12-fix_semantic_missing_reference_when_export_default_references_a_type_alias_binding Change
semantic[cal.com.tsx] 28.2 ms 29.1 ms -3.15%

@Dunqing Dunqing marked this pull request as draft December 12, 2024 05:40
@Dunqing Dunqing removed the needs-discussion Requires a discussion from the core team label Dec 12, 2024
@Dunqing Dunqing marked this pull request as ready for review December 12, 2024 14:07
@Dunqing Dunqing added the 0-merge Merge with Graphite Merge Queue label Dec 12, 2024
Copy link
Member Author

Dunqing commented Dec 12, 2024

Merge activity

  • Dec 12, 9:08 AM EST: The merge label '0-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Dec 12, 9:08 AM EST: A user added this pull request to the Graphite merge queue.
  • Dec 12, 9:18 AM EST: A user merged this pull request with the Graphite merge queue.

Dunqing added a commit that referenced this pull request Dec 12, 2024
…ype alias binding (#7813)

Fixes: #7809

`ExportNamedDecalration` and `ExportDefaultDeclaration` can reference both type binding and value, so we need to make sure the `ReferenceFlags` is `Read | Type`
@Dunqing Dunqing force-pushed the 12-12-fix_semantic_missing_reference_when_export_default_references_a_type_alias_binding branch from 2c61a3c to 44846fa Compare December 12, 2024 14:08
@Dunqing
Copy link
Member Author

Dunqing commented Dec 12, 2024

Merging this and making a small refactor in follow-up PR

…ype alias binding (#7813)

Fixes: #7809

`ExportNamedDecalration` and `ExportDefaultDeclaration` can reference both type binding and value, so we need to make sure the `ReferenceFlags` is `Read | Type`
@Dunqing Dunqing force-pushed the 12-12-fix_semantic_missing_reference_when_export_default_references_a_type_alias_binding branch from 44846fa to 7a83230 Compare December 12, 2024 14:12
@graphite-app graphite-app bot merged commit 7a83230 into main Dec 12, 2024
25 checks passed
@graphite-app graphite-app bot deleted the 12-12-fix_semantic_missing_reference_when_export_default_references_a_type_alias_binding branch December 12, 2024 14:18
This was referenced Dec 13, 2024
Boshen added a commit that referenced this pull request Dec 13, 2024
## [0.15.1] - 2024-12-13

### Features

- 38b1c2e editor: Create a command to apply all auto-fixes for the
current active text editor (#7672) (Nicholas Rayburn)

### Bug Fixes

- 2b187e5 linter: Fix configuration casing for
`typescript/no_this_alias` (#7836) (Boshen)
- 06e6d38 linter: Fix unicorn/prefer-query-selector to use the correct
replacement for getElementsByClassName (#7796) (Nicholas Rayburn)
- 7a83230 semantic: Missing reference when `export default` references a
type alias binding (#7813) (Dunqing)

Co-authored-by: Boshen <[email protected]>
Boshen added a commit that referenced this pull request Dec 13, 2024
## [0.41.0] - 2024-12-13

- fb325dc ast: [**BREAKING**] `span` field must be the first element
(#7821) (Boshen)

- 96a26d3 ast: [**BREAKING**] Rename `is_strict` methods to
`has_use_strict_directive` (#7783) (overlookmotel)

### Features

- 8991f33 ast: Add `visit_span` to `Visit` and `VisitMut` (#7816)
(overlookmotel)
- f7900ab ast: Add `ArrowFunctionExpression::has_use_strict_directive`
method (#7784) (overlookmotel)
- e727ae9 transformer/class-properties: Transform super member
expressions that are inside static prop initializer (#7815) (Dunqing)

### Bug Fixes

- 7610dc1 parser: Parse `import source from 'mod'` (#7833) (Boshen)
- 9479e2b semantic: Missing references when `export {}` references a
type-only binding and a normal (#7812) (Yunfei He)
- 7a83230 semantic: Missing reference when `export default` references a
type alias binding (#7813) (Dunqing)
- 4a3bca8 semantic: Fix identifying strict mode arrow functions (#7785)
(overlookmotel)
- 5b7e1ad transformer: Remove span of define value (#7811) (Hiroshi
Ogawa)
- 14896cb transformer/class-properties: Create temp vars in correct
scope (#7824) (overlookmotel)
- 25bb6da transformer/class-properties: Fix `ScopeId`s in instance prop
initializers (#7823) (overlookmotel)
- 65b109a transformer/class-properties: No `raw` for generated
`StringLiteral` (#7825) (overlookmotel)
- 2964a61 transformer/class-properties: Unwrap failed when private field
expression doesn't contain optional expression in `ChainExpression`
(#7798) (Dunqing)
- 6fa6785 transformer/class-properties: Panic when the callee or member
is `ParenthesisExpression` or TS-syntax expressions. (#7795) (Dunqing)
- bb22c67 transformer/class-properties: Fix `ScopeId`s in static prop
initializers (#7791) (overlookmotel)
- caa57f1 transformer/class-properties: Fix scope flags in static prop
initializers (#7786) (overlookmotel)

### Performance

- 4448b63 codegen: Faster writing indentation (#7820) (overlookmotel)
- afaaffa codegen: Fast path for `options.print_comments()` (#7806)
(Boshen)

### Refactor

- 0f367e5 semantic: Improve the logic of resolving references to be
cleaner (#7829) (Dunqing)
- 5710950 semantic: Move export-related reference flags logic to visit
functions (#7828) (Dunqing)
- b290ebd transformer: Handle `<CWD>` in test runner (#7799) (Dunqing)
- e70deb9 transformer/class-properties: Locate instance props insertion
location in separate step (#7819) (overlookmotel)
- afc5f1e transformer/class-properties: De-deduplicate code (#7805)
(overlookmotel)
- 47a91d2 transformer/class-properties: Shorten code (#7804)
(overlookmotel)
- 54ef2b9 transformer/class-properties: Rename
`debug_assert_expr_is_not_parenthesis_or_typescript_syntax` (#7803)
(overlookmotel)
- 3cdc47c transformer/class-properties: `#[inline(always)]` on
`assert_expr_neither_parenthesis_nor_typescript_syntax` (#7802)
(overlookmotel)

### Testing

- d72c888 transformer/replace-global-defines: Remove panicking test
(#7838) (overlookmotel)

Co-authored-by: Boshen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0-merge Merge with Graphite Merge Queue A-linter Area - Linter A-semantic Area - Semantic C-bug Category - Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

linter: no-unused-vars false positive for TSTypeAliasDeclaration with ExportDefaultDeclaration
2 participants