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 issue with name clash on auto implementation of AbiEncode and AbiDecode #6044

Merged
merged 18 commits into from
Jun 11, 2024

Conversation

jjcnn
Copy link
Contributor

@jjcnn jjcnn commented May 22, 2024

Description

Fixes #5500 . Also fixes the issue that caused one of @xunilrj 's tests to fail.

The callpaths generated for struct declarations have so far been incorrect. The shadowed_glob_imports test case shows how this causes a compilation error when there is a name clash between a star imported struct and a locally declared struct. This causes a number of issues, in particular that the generated trait impls of AbiEncode and AbiDecode can refer to the wrong type or to a type that doesn't exist.

The incorrect paths were the result of a combination of two bugs:

  1. The is_external flag on the containing modules was often set incorrectly. In particular, core often had is_external = false, leading to the package name being added to the path of anything declared in core.
  2. When typechecking a struct/enum declaration we would look up paths in the current environment before the name of the struct/enum was bound in the environment. If a type with the same name had already been imported this lookup would result in a path to the import source module rather than the path to current module (which is obviously where the struct/enum is located).

This PR fixes both bugs:

  1. When initializing the root namespace we now ensure that all modules that have already been added are marked with is_external = true. This happens in Namespace::init_root().
  2. When typechecking a type declaration we generate the callpath directly from the name of the type and the path of the current module. This happens in CallPath::ident_to_fullpath().

Step 1 unfortunately adds an extra cloning step in the namespace module, but I don't think it's avoidable at the moment. To avoid this extra cloning step we would need to have a better way of building the external module structure than we currently have. #5498 tracks this and other issues.

The improved callpath generation should move us a step closer towards fixing #4700.

Checklist

  • I have linked to any relevant issues.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have updated the documentation where relevant (API docs, the reference, and the Sway book).
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added (or requested a maintainer to add) the necessary Breaking* or New Feature labels where relevant.
  • I have done my best to ensure that my PR adheres to the Fuel Labs Code Review Standards.
  • I have requested a review from the relevant team or maintainers.

Copy link

Benchmark for a862118

Click to view benchmark
Test Base PR %
code_action 5.3±0.12ms 5.2±0.11ms -1.89%
code_lens 283.4±11.95ns 285.5±13.60ns +0.74%
compile 3.0±0.03s 3.0±0.05s 0.00%
completion 4.5±0.09ms 4.5±0.02ms 0.00%
did_change_with_caching 2.8±0.04s 2.9±0.04s +3.57%
document_symbol 1002.9±42.51µs 1038.9±24.03µs +3.59%
format 74.6±0.95ms 75.0±1.04ms +0.54%
goto_definition 424.9±7.32µs 376.7±30.83µs -11.34%
highlight 8.8±0.05ms 8.8±0.21ms 0.00%
hover 541.7±5.53µs 493.9±7.43µs -8.82%
idents_at_position 124.3±0.47µs 122.7±1.10µs -1.29%
inlay_hints 707.5±18.21µs 661.3±27.91µs -6.53%
on_enter 456.4±13.03ns 494.7±9.24ns +8.39%
parent_decl_at_position 3.6±0.03ms 3.6±0.05ms 0.00%
prepare_rename 421.8±5.04µs 376.6±5.58µs -10.72%
rename 9.4±0.17ms 9.3±0.02ms -1.06%
semantic_tokens 993.1±20.77µs 1004.5±43.31µs +1.15%
token_at_position 364.7±2.81µs 362.3±1.46µs -0.66%
tokens_at_position 3.6±0.03ms 3.6±0.02ms 0.00%
tokens_for_file 417.4±13.50µs 417.4±1.24µs 0.00%
traverse 40.5±1.35ms 42.2±0.90ms +4.20%

@jjcnn jjcnn changed the title Activate failing test, add first fix Fix issue with name clash on auto implementation of AbiEncode and AbiDecode May 22, 2024
Copy link

Benchmark for f47438a

Click to view benchmark
Test Base PR %
code_action 5.2±0.12ms 5.2±0.09ms 0.00%
code_lens 334.8±9.69ns 336.9±40.30ns +0.63%
compile 3.0±0.07s 3.1±0.05s +3.33%
completion 4.6±0.29ms 4.5±0.09ms -2.17%
did_change_with_caching 2.9±0.03s 3.0±0.04s +3.45%
document_symbol 957.6±17.31µs 950.5±17.14µs -0.74%
format 73.7±1.31ms 74.4±0.58ms +0.95%
goto_definition 363.6±6.78µs 370.0±5.26µs +1.76%
highlight 8.8±0.12ms 8.8±0.13ms 0.00%
hover 483.2±9.75µs 491.2±5.62µs +1.66%
idents_at_position 123.6±0.39µs 125.9±0.57µs +1.86%
inlay_hints 643.2±10.71µs 662.5±26.53µs +3.00%
on_enter 472.4±18.82ns 460.2±15.61ns -2.58%
parent_decl_at_position 3.6±0.03ms 3.6±0.02ms 0.00%
prepare_rename 357.4±6.68µs 370.7±6.31µs +3.72%
rename 9.3±0.18ms 9.3±0.28ms 0.00%
semantic_tokens 972.9±13.47µs 966.7±13.43µs -0.64%
token_at_position 356.6±2.22µs 370.3±1.81µs +3.84%
tokens_at_position 3.6±0.04ms 3.6±0.08ms 0.00%
tokens_for_file 419.7±3.61µs 425.1±3.69µs +1.29%
traverse 41.6±1.62ms 42.2±1.86ms +1.44%

@ironcev
Copy link
Member

ironcev commented May 27, 2024

@jjcnn Setting is_external = <current is external> is a valid change as long as I can see. But it looks like it triggered some other issues which apparently rely on the existing setting of is_external to false.

I've taken a look a look at the failing tests for references. The failures has nothing to do with references as such. They are caused by the facts that all of those tests have a separate file with traits defined in them (impls.sw), as well as trait implementations. Those traits now do not get properly resolved.

Also, there are other E2E tests failing like:

should_pass/language/use_absolute_path
should_pass/language/generic_impl_self_where

They also have traits defined in separate files and used in main.sw.

To the E2E tests, the go_to_definition_for_paths LSP tests is also failing perhaps for the same reason.

It looks to me that the simple one line change triggered some other issues related to trait import and resolution.

One thought crossing my mind. The opening sentence in the PR description:

The callpaths generated for struct declarations are incorrect

reminds me a lot of #5500. Perhaps it makes sense to take a closer look on that issue and fix it first.

@jjcnn
Copy link
Contributor Author

jjcnn commented May 30, 2024

@ironcev : Thanks - that helps quite a bit. I'll take a look at the issue you linked to, and keep digging.

@jjcnn
Copy link
Contributor Author

jjcnn commented May 31, 2024

@ironcev : Sadly, a fix of #5500 does not solve the problem, but I suspect it's just another one of many interlocking issues, so I've pushed a fix and continuing from here.

Copy link

Benchmark for 410a412

Click to view benchmark
Test Base PR %
code_action 5.3±0.09ms 5.5±0.13ms +3.77%
code_lens 340.8±32.68ns 287.0±7.41ns -15.79%
compile 3.1±0.05s 3.1±0.10s 0.00%
completion 4.9±0.25ms 4.7±0.06ms -4.08%
did_change_with_caching 3.0±0.05s 3.0±0.04s 0.00%
document_symbol 977.7±40.75µs 1019.5±57.53µs +4.28%
format 73.9±0.82ms 73.9±1.02ms 0.00%
goto_definition 373.6±6.99µs 363.0±8.30µs -2.84%
highlight 9.0±0.21ms 9.2±0.62ms +2.22%
hover 494.4±5.34µs 488.4±10.66µs -1.21%
idents_at_position 124.1±0.76µs 126.0±0.38µs +1.53%
inlay_hints 654.3±28.22µs 666.9±14.18µs +1.93%
on_enter 474.5±10.78ns 471.7±11.97ns -0.59%
parent_decl_at_position 3.7±0.09ms 3.8±0.04ms +2.70%
prepare_rename 366.0±6.16µs 363.3±6.89µs -0.74%
rename 9.4±0.27ms 9.7±0.07ms +3.19%
semantic_tokens 991.6±14.99µs 954.0±18.07µs -3.79%
token_at_position 362.3±3.53µs 360.7±2.18µs -0.44%
tokens_at_position 3.8±0.11ms 3.7±0.03ms -2.63%
tokens_for_file 432.0±2.61µs 423.4±4.15µs -1.99%
traverse 41.7±0.89ms 42.3±1.89ms +1.44%

Copy link

github-actions bot commented Jun 3, 2024

Benchmark for f1ddf14

Click to view benchmark
Test Base PR %
code_action 5.5±0.05ms 5.3±0.17ms -3.64%
code_lens 335.7±14.11ns 338.8±7.39ns +0.92%
compile 4.0±0.10s 4.1±0.08s +2.50%
completion 4.7±0.09ms 4.6±0.04ms -2.13%
did_change_with_caching 3.7±0.08s 3.7±0.09s 0.00%
document_symbol 1000.4±39.01µs 980.0±35.77µs -2.04%
format 73.0±0.68ms 74.8±0.82ms +2.47%
goto_definition 365.1±11.16µs 361.0±6.83µs -1.12%
highlight 9.0±0.17ms 8.8±0.36ms -2.22%
hover 534.4±3.30µs 535.8±3.55µs +0.26%
idents_at_position 123.1±0.42µs 124.0±1.30µs +0.73%
inlay_hints 664.1±8.72µs 648.5±22.91µs -2.35%
on_enter 454.2±14.38ns 456.9±6.88ns +0.59%
parent_decl_at_position 3.7±0.05ms 3.6±0.01ms -2.70%
prepare_rename 363.4±8.08µs 360.6±9.06µs -0.77%
rename 9.6±0.15ms 9.4±0.25ms -2.08%
semantic_tokens 966.2±11.17µs 976.8±17.98µs +1.10%
token_at_position 352.7±3.37µs 355.1±2.18µs +0.68%
tokens_at_position 3.7±0.02ms 3.6±0.02ms -2.70%
tokens_for_file 430.3±3.36µs 429.8±9.02µs -0.12%
traverse 39.7±2.08ms 41.1±1.66ms +3.53%

Copy link

github-actions bot commented Jun 5, 2024

Benchmark for 85fd359

Click to view benchmark
Test Base PR %
code_action 5.4±0.02ms 5.4±0.23ms 0.00%
code_lens 337.7±12.73ns 336.6±6.97ns -0.33%
compile 4.1±0.21s 4.0±0.10s -2.44%
completion 4.7±0.05ms 4.8±0.04ms +2.13%
did_change_with_caching 4.0±0.06s 3.6±0.07s -10.00%
document_symbol 967.1±18.89µs 990.9±9.38µs +2.46%
format 74.8±1.32ms 73.6±1.78ms -1.60%
goto_definition 365.8±9.13µs 365.3±6.67µs -0.14%
highlight 9.0±0.20ms 9.0±0.04ms 0.00%
hover 539.9±7.95µs 540.6±6.24µs +0.13%
idents_at_position 123.0±0.42µs 129.9±1.38µs +5.61%
inlay_hints 663.9±13.06µs 664.6±21.62µs +0.11%
on_enter 459.1±9.02ns 465.6±15.43ns +1.42%
parent_decl_at_position 3.7±0.04ms 3.7±0.04ms 0.00%
prepare_rename 366.0±6.67µs 432.1±5.04µs +18.06%
rename 9.6±0.05ms 9.6±0.39ms 0.00%
semantic_tokens 973.0±18.12µs 985.4±31.12µs +1.27%
token_at_position 362.0±3.48µs 360.6±2.81µs -0.39%
tokens_at_position 3.7±0.05ms 3.7±0.04ms 0.00%
tokens_for_file 442.8±26.56µs 427.3±1.44µs -3.50%
traverse 43.0±1.51ms 39.2±0.83ms -8.84%

@jjcnn jjcnn requested review from xunilrj, tritao, ironcev and hal3e June 6, 2024 11:21
Copy link

github-actions bot commented Jun 6, 2024

Benchmark for d548db3

Click to view benchmark
Test Base PR %
code_action 5.4±0.25ms 5.4±0.16ms 0.00%
code_lens 335.9±8.83ns 334.0±17.05ns -0.57%
compile 4.1±0.07s 4.2±0.07s +2.44%
completion 5.1±0.63ms 4.8±0.13ms -5.88%
did_change_with_caching 3.8±0.08s 3.8±0.08s 0.00%
document_symbol 995.8±50.33µs 1046.1±28.32µs +5.05%
format 74.7±0.87ms 75.6±1.60ms +1.20%
goto_definition 349.1±6.65µs 367.2±7.02µs +5.18%
highlight 9.0±0.11ms 9.1±0.40ms +1.11%
hover 538.4±7.02µs 550.5±14.82µs +2.25%
idents_at_position 122.9±0.44µs 124.6±1.50µs +1.38%
inlay_hints 650.2±23.01µs 658.0±12.28µs +1.20%
on_enter 458.2±12.51ns 462.1±14.71ns +0.85%
parent_decl_at_position 3.8±0.18ms 3.9±0.37ms +2.63%
prepare_rename 350.8±13.11µs 368.0±6.39µs +4.90%
rename 9.6±0.28ms 9.8±0.43ms +2.08%
semantic_tokens 972.0±17.62µs 988.1±26.19µs +1.66%
token_at_position 356.9±3.85µs 356.9±2.90µs 0.00%
tokens_at_position 3.8±0.30ms 3.8±0.16ms 0.00%
tokens_for_file 430.8±4.41µs 431.7±2.75µs +0.21%
traverse 41.7±1.20ms 40.9±1.11ms -1.92%

@jjcnn jjcnn marked this pull request as ready for review June 6, 2024 12:07
@jjcnn jjcnn requested review from a team as code owners June 6, 2024 12:07
Copy link

github-actions bot commented Jun 6, 2024

Benchmark for d252efd

Click to view benchmark
Test Base PR %
code_action 5.4±0.02ms 5.4±0.02ms 0.00%
code_lens 336.8±11.28ns 333.9±11.54ns -0.86%
compile 4.0±0.09s 4.0±0.08s 0.00%
completion 4.8±0.13ms 4.8±0.08ms 0.00%
did_change_with_caching 3.7±0.06s 3.7±0.08s 0.00%
document_symbol 1017.7±48.90µs 1018.3±31.36µs +0.06%
format 74.0±1.41ms 73.8±1.66ms -0.27%
goto_definition 360.0±7.72µs 362.4±6.25µs +0.67%
highlight 9.0±0.12ms 9.0±0.14ms 0.00%
hover 532.2±8.27µs 537.9±5.31µs +1.07%
idents_at_position 122.7±0.53µs 124.6±1.14µs +1.55%
inlay_hints 668.5±41.12µs 660.6±22.43µs -1.18%
on_enter 456.1±11.77ns 448.8±9.79ns -1.60%
parent_decl_at_position 3.7±0.03ms 3.7±0.04ms 0.00%
prepare_rename 358.2±11.30µs 425.1±2.39µs +18.68%
rename 9.6±0.26ms 9.6±0.04ms 0.00%
semantic_tokens 982.6±12.75µs 982.0±20.53µs -0.06%
token_at_position 356.6±3.22µs 356.9±2.27µs +0.08%
tokens_at_position 3.7±0.04ms 3.7±0.03ms 0.00%
tokens_for_file 435.4±4.25µs 435.6±2.42µs +0.05%
traverse 40.5±1.06ms 40.2±1.07ms -0.74%

Copy link

github-actions bot commented Jun 6, 2024

Benchmark for 5ef7c7a

Click to view benchmark
Test Base PR %
code_action 5.4±0.09ms 5.4±0.04ms 0.00%
code_lens 335.4±13.47ns 341.3±13.65ns +1.76%
compile 4.1±0.11s 4.1±0.09s 0.00%
completion 4.7±0.12ms 4.8±0.10ms +2.13%
did_change_with_caching 3.8±0.08s 3.8±0.06s 0.00%
document_symbol 963.8±16.66µs 993.6±19.50µs +3.09%
format 74.4±1.60ms 73.7±0.52ms -0.94%
goto_definition 355.0±8.24µs 370.2±4.93µs +4.28%
highlight 9.0±0.21ms 9.0±0.15ms 0.00%
hover 532.4±17.58µs 554.4±7.87µs +4.13%
idents_at_position 122.2±0.46µs 122.9±0.93µs +0.57%
inlay_hints 658.0±27.15µs 666.3±32.94µs +1.26%
on_enter 463.9±21.11ns 462.9±18.07ns -0.22%
parent_decl_at_position 3.7±0.03ms 3.7±0.30ms 0.00%
prepare_rename 363.0±5.76µs 373.2±9.86µs +2.81%
rename 9.7±0.16ms 9.6±0.22ms -1.03%
semantic_tokens 964.4±27.82µs 990.7±8.69µs +2.73%
token_at_position 349.0±3.10µs 357.1±3.94µs +2.32%
tokens_at_position 3.7±0.04ms 3.7±0.04ms 0.00%
tokens_for_file 429.8±2.38µs 426.9±2.72µs -0.67%
traverse 41.5±1.39ms 40.5±0.95ms -2.41%

Copy link

github-actions bot commented Jun 7, 2024

Benchmark for 78ff707

Click to view benchmark
Test Base PR %
code_action 5.3±0.12ms 5.3±0.24ms 0.00%
code_lens 288.3±13.13ns 290.7±8.66ns +0.83%
compile 4.0±0.08s 4.0±0.07s 0.00%
completion 4.7±0.19ms 4.6±0.02ms -2.13%
did_change_with_caching 3.7±0.06s 3.7±0.10s 0.00%
document_symbol 1006.9±19.36µs 970.0±12.46µs -3.66%
format 72.2±1.26ms 70.7±0.91ms -2.08%
goto_definition 404.2±5.39µs 374.2±8.54µs -7.42%
highlight 8.8±0.12ms 8.7±0.05ms -1.14%
hover 569.4±4.85µs 555.5±8.99µs -2.44%
idents_at_position 123.9±0.49µs 122.1±0.75µs -1.45%
inlay_hints 678.4±54.16µs 654.6±19.58µs -3.51%
on_enter 466.7±7.95ns 467.0±7.36ns +0.06%
parent_decl_at_position 3.6±0.09ms 3.6±0.03ms 0.00%
prepare_rename 395.7±4.77µs 371.5±7.70µs -6.12%
rename 9.3±0.22ms 9.3±0.40ms 0.00%
semantic_tokens 1004.1±17.63µs 971.6±21.57µs -3.24%
token_at_position 363.9±3.98µs 368.9±2.09µs +1.37%
tokens_at_position 3.6±0.08ms 3.6±0.11ms 0.00%
tokens_for_file 418.7±4.00µs 426.7±2.19µs +1.91%
traverse 40.2±2.02ms 39.5±1.01ms -1.74%

Co-authored-by: João Matos <joao@tritao.eu>
Copy link

github-actions bot commented Jun 7, 2024

Benchmark for 4fecbf8

Click to view benchmark
Test Base PR %
code_action 5.4±0.18ms 5.4±0.14ms 0.00%
code_lens 287.3±6.12ns 289.6±7.02ns +0.80%
compile 4.1±0.08s 4.2±0.09s +2.44%
completion 4.8±0.21ms 4.7±0.15ms -2.08%
did_change_with_caching 3.8±0.10s 3.8±0.07s 0.00%
document_symbol 1000.6±34.44µs 949.1±22.21µs -5.15%
format 71.3±0.71ms 72.2±2.59ms +1.26%
goto_definition 360.4±6.90µs 365.9±5.89µs +1.53%
highlight 8.8±0.56ms 9.0±0.57ms +2.27%
hover 538.9±8.60µs 538.0±8.59µs -0.17%
idents_at_position 122.3±0.26µs 123.1±1.71µs +0.65%
inlay_hints 651.0±18.91µs 651.0±29.80µs 0.00%
on_enter 464.8±27.87ns 473.9±8.53ns +1.96%
parent_decl_at_position 3.6±0.04ms 3.6±0.06ms 0.00%
prepare_rename 360.7±7.22µs 364.7±11.75µs +1.11%
rename 9.4±0.20ms 9.5±0.18ms +1.06%
semantic_tokens 981.7±43.86µs 971.8±23.99µs -1.01%
token_at_position 355.8±3.86µs 359.8±2.74µs +1.12%
tokens_at_position 3.6±0.09ms 3.6±0.06ms 0.00%
tokens_for_file 423.0±5.49µs 426.8±3.82µs +0.90%
traverse 40.7±1.32ms 40.4±0.84ms -0.74%

Copy link
Contributor

@IGI-111 IGI-111 left a comment

Choose a reason for hiding this comment

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

Nice!
I appreciate how well commented this is given how unintuitive the callpaths can be. 👍

Copy link

Benchmark for f58cb90

Click to view benchmark
Test Base PR %
code_action 5.4±0.08ms 5.3±0.15ms -1.85%
code_lens 287.1±15.32ns 289.9±11.61ns +0.98%
compile 4.1±0.09s 4.2±0.08s +2.44%
completion 4.8±0.32ms 4.8±0.27ms 0.00%
did_change_with_caching 3.8±0.06s 3.8±0.06s 0.00%
document_symbol 1057.8±14.93µs 1016.4±47.15µs -3.91%
format 70.9±0.86ms 72.7±0.68ms +2.54%
goto_definition 364.6±5.26µs 365.7±6.96µs +0.30%
highlight 8.9±0.35ms 8.8±0.22ms -1.12%
hover 544.2±9.25µs 542.9±11.04µs -0.24%
idents_at_position 123.4±0.28µs 122.5±1.24µs -0.73%
inlay_hints 650.5±16.06µs 664.5±53.39µs +2.15%
on_enter 462.2±10.47ns 455.1±12.81ns -1.54%
parent_decl_at_position 3.7±0.12ms 3.6±0.06ms -2.70%
prepare_rename 364.2±6.90µs 364.7±6.74µs +0.14%
rename 9.5±0.29ms 9.5±0.30ms 0.00%
semantic_tokens 951.9±19.09µs 990.4±40.79µs +4.04%
token_at_position 365.1±2.58µs 357.4±2.65µs -2.11%
tokens_at_position 3.6±0.05ms 3.6±0.12ms 0.00%
tokens_for_file 421.8±2.50µs 417.8±3.51µs -0.95%
traverse 41.1±1.32ms 40.6±0.77ms -1.22%

Copy link
Contributor

@hal3e hal3e left a comment

Choose a reason for hiding this comment

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

I tried it with this branch but I still get an error. Unfortunately, I do not get any specifics just: error: Could not generate the entry method. See errors above for more details. and there is nothing above :/.
Steps to recreate:

  • clone fuels-rs and checkout hal3e/name-clash-abi-encode
  • cd into fuels-rs/e2e/sway/bindings/type_paths
  • forc build or forc build --json-abi-with-callpaths

P.S. I installed forc with:
cargo install --locked forc --force --git https://github.com/FuelLabs/sway --branch "jjcnn/name_clash_struct_def_glob_import"

@jjcnn
Copy link
Contributor Author

jjcnn commented Jun 10, 2024

I tried it with this branch but I still get an error. Unfortunately, I do not get any specifics just: error: Could not generate the entry method. See errors above for more details. and there is nothing above :/. Steps to recreate:

* clone `fuels-rs` and checkout `hal3e/name-clash-abi-encode`

* cd into `fuels-rs/e2e/sway/bindings/type_paths`

* `forc build` or `forc build --json-abi-with-callpaths`

P.S. I installed forc with: cargo install --locked forc --force --git https://github.com/FuelLabs/sway --branch "jjcnn/name_clash_struct_def_glob_import"

Doing the above does indeed still fail. I originally tried to recreate your test case within the sway repo where it seemed to compile, but it no longer does, so there's something else going on.

I'll remove the references to #5864 from this PR, and add your recreation steps to the issue.

Copy link

Benchmark for 290fe2f

Click to view benchmark
Test Base PR %
code_action 5.3±0.36ms 5.1±0.10ms -3.77%
code_lens 349.3±56.04ns 338.8±11.33ns -3.01%
compile 3.6±0.07s 3.6±0.09s 0.00%
completion 4.8±0.29ms 4.7±0.22ms -2.08%
did_change_with_caching 3.3±0.08s 3.4±0.06s +3.03%
document_symbol 980.3±15.99µs 945.2±19.87µs -3.58%
format 89.2±1.36ms 88.8±1.40ms -0.45%
goto_definition 360.5±19.03µs 359.7±7.72µs -0.22%
highlight 8.8±0.21ms 8.9±0.22ms +1.14%
hover 584.6±10.31µs 589.9±30.35µs +0.91%
idents_at_position 121.3±0.57µs 121.6±2.33µs +0.25%
inlay_hints 661.8±29.51µs 659.6±17.44µs -0.33%
on_enter 447.8±4.77ns 467.9±20.07ns +4.49%
parent_decl_at_position 3.6±0.08ms 3.6±0.12ms 0.00%
prepare_rename 360.7±6.92µs 358.8±16.71µs -0.53%
rename 9.3±0.33ms 9.1±0.15ms -2.15%
semantic_tokens 978.8±33.03µs 971.0±22.26µs -0.80%
token_at_position 351.7±4.46µs 350.9±9.55µs -0.23%
tokens_at_position 3.6±0.05ms 3.6±0.14ms 0.00%
tokens_for_file 410.7±2.15µs 414.0±2.72µs +0.80%
traverse 38.6±0.84ms 39.0±0.92ms +1.04%

@IGI-111 IGI-111 merged commit 76595ed into master Jun 11, 2024
38 checks passed
@IGI-111 IGI-111 deleted the jjcnn/name_clash_struct_def_glob_import branch June 11, 2024 16:29
@jjcnn jjcnn mentioned this pull request Jul 9, 2024
8 tasks
IGI-111 pushed a commit that referenced this pull request Jul 9, 2024
## Description

#6044 increased the memory usage of the compiler by an estimated 400%.
This PR alleviates some of that increased footprint.

`is_external` in the `Module` struct needs to be updated to allow for
compilation of dependencies (a module is not external while it is being
compiled, but is external when one of its dependents is being compiled).
#6044 introduced an extra level of cloning, which in this PR is changed
by making `Module` mutable and destructively updating `is_external`.

## Checklist

- [x] I have linked to any relevant issues.
- [x] I have commented my code, particularly in hard-to-understand
areas.
- [x] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [ ] If my change requires substantial documentation changes, I have
[requested support from the DevRel
team](https://github.com/FuelLabs/devrel-requests/issues/new/choose)
- [x] I have added tests that prove my fix is effective or that my
feature works.
- [x] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [x] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [x] I have requested a review from the relevant team or maintainers.
esdrubal pushed a commit that referenced this pull request Aug 13, 2024
## Description

#6044 increased the memory usage of the compiler by an estimated 400%.
This PR alleviates some of that increased footprint.

`is_external` in the `Module` struct needs to be updated to allow for
compilation of dependencies (a module is not external while it is being
compiled, but is external when one of its dependents is being compiled).
#6044 introduced an extra level of cloning, which in this PR is changed
by making `Module` mutable and destructively updating `is_external`.

## Checklist

- [x] I have linked to any relevant issues.
- [x] I have commented my code, particularly in hard-to-understand
areas.
- [x] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [ ] If my change requires substantial documentation changes, I have
[requested support from the DevRel
team](https://github.com/FuelLabs/devrel-requests/issues/new/choose)
- [x] I have added tests that prove my fix is effective or that my
feature works.
- [x] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [x] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [x] I have requested a review from the relevant team or maintainers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrong TyStructDecl::call_path when using glob imports with local shadowing
6 participants