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

feat(semantic): add some scopes to align TypeScript's container #3969

Conversation

Dunqing
Copy link
Member

@Dunqing Dunqing commented Jun 29, 2024

This pr is a prototype to fix #2023. We have added scope to some nodes

Copy link

graphite-app bot commented Jun 29, 2024

Your org has enabled the Graphite merge queue for merging into main

Add the label “merge” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge. Or use the label “hotfix” to add to the merge queue as a hot fix.

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

@github-actions github-actions bot added A-parser Area - Parser A-semantic Area - Semantic A-ast Area - AST labels Jun 29, 2024
Copy link
Member Author

Dunqing commented Jun 29, 2024

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

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

Join @Dunqing and the rest of your teammates on Graphite Graphite

Copy link

codspeed-hq bot commented Jun 29, 2024

CodSpeed Performance Report

Merging #3969 will not alter performance

Comparing 06-29-feat_semantic_add_some_scopes_to_align_typescript_s_container (5c75f05) with 07-10-refactor_semantic_add_strict_mode_in_scope_flags_for_class_definitions (2f41660)

Summary

✅ 31 untouched benchmarks

@Dunqing Dunqing force-pushed the 06-29-feat_semantic_add_some_scopes_to_align_typescript_s_container branch 3 times, most recently from c673495 to 44587fa Compare June 29, 2024 09:53
@Dunqing Dunqing force-pushed the 06-29-feat_semantic_add_some_scopes_to_align_typescript_s_container branch from 44587fa to cbd672e Compare June 29, 2024 09:58
@@ -237,6 +238,7 @@ pub struct TSConditionalType<'a> {
pub extends_type: TSType<'a>,
pub true_type: TSType<'a>,
pub false_type: TSType<'a>,
pub scope_id: Cell<Option<ScopeId>>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would Option<Cell<ScopeId>> be better or worse?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It has to be Cell<Option<ScopeId>> because the Option value needs to be mutated from None to Some(...) with only an immutable &TSConditionalType (in Semantic).

@Dunqing Dunqing force-pushed the 06-29-feat_semantic_add_some_scopes_to_align_typescript_s_container branch from cbd672e to 86b4b58 Compare July 1, 2024 16:16
@Dunqing Dunqing force-pushed the 06-29-feat_semantic_add_some_scopes_to_align_typescript_s_container branch 2 times, most recently from b6ef7ca to 53efc22 Compare July 10, 2024 06:06
@Dunqing Dunqing changed the base branch from main to 07-10-refactor_semantic_add_strict_mode_in_scope_flags_for_class_definitions July 10, 2024 06:06
@Dunqing Dunqing force-pushed the 07-10-refactor_semantic_add_strict_mode_in_scope_flags_for_class_definitions branch from df02c40 to f676841 Compare July 10, 2024 08:40
@Dunqing Dunqing force-pushed the 06-29-feat_semantic_add_some_scopes_to_align_typescript_s_container branch from 53efc22 to c46b60d Compare July 10, 2024 08:40
@Dunqing Dunqing force-pushed the 07-10-refactor_semantic_add_strict_mode_in_scope_flags_for_class_definitions branch 2 times, most recently from e88e957 to e9192fb Compare July 11, 2024 08:25
@Dunqing Dunqing force-pushed the 06-29-feat_semantic_add_some_scopes_to_align_typescript_s_container branch from c46b60d to 1244aab Compare July 11, 2024 08:25
@Dunqing Dunqing marked this pull request as ready for review July 11, 2024 08:25
@Dunqing Dunqing marked this pull request as draft July 11, 2024 08:26
@Dunqing Dunqing force-pushed the 07-10-refactor_semantic_add_strict_mode_in_scope_flags_for_class_definitions branch from e9192fb to 2f41660 Compare July 11, 2024 08:51
@Dunqing Dunqing force-pushed the 06-29-feat_semantic_add_some_scopes_to_align_typescript_s_container branch from 1244aab to 5c75f05 Compare July 11, 2024 08:51
@Dunqing Dunqing force-pushed the 07-10-refactor_semantic_add_strict_mode_in_scope_flags_for_class_definitions branch from 2f41660 to f171c7e Compare July 14, 2024 03:31
@Boshen Boshen force-pushed the 07-10-refactor_semantic_add_strict_mode_in_scope_flags_for_class_definitions branch from f171c7e to dc2b3c4 Compare July 14, 2024 03:35
@Boshen Boshen changed the base branch from 07-10-refactor_semantic_add_strict_mode_in_scope_flags_for_class_definitions to main July 14, 2024 03:40
@Dunqing
Copy link
Member Author

Dunqing commented Jul 16, 2024

Superseded by #4280

@Dunqing Dunqing closed this Jul 16, 2024
Boshen pushed a commit that referenced this pull request Jul 17, 2024
close: #3969
close: #2023

We need to add scope according to [this](https://github.com/microsoft/TypeScript/blob/d8086f14b6b97c0df34a0cc2f56d4b5926a0c299/src/compiler/binder.ts#L3883-L3962). There are still some ASTs that need to be added to the scope.

---

Context from @Boshen:

Before this whole journey of fixing symbols and scopes I asked @Dunqing to debug through binder.ts via a debugger to fully understand how it does resolution.

We then agreed to align the implementation so that when a problem occurs, we can debug through both implementations and find where our problem is.

tsc doesn't have a specification, so we need to align with the reference implementation instead.
@Boshen Boshen deleted the 06-29-feat_semantic_add_some_scopes_to_align_typescript_s_container branch September 11, 2024 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ast Area - AST A-parser Area - Parser A-semantic Area - Semantic
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect symbol references
3 participants