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

Fixes assert in type_check_encode_buffer_empty. #6364

Merged
merged 2 commits into from
Aug 7, 2024
Merged

Conversation

esdrubal
Copy link
Contributor

@esdrubal esdrubal commented Aug 6, 2024

Description

Assert in type_check_encode_buffer_empty was causing the compiler to crash.

We now throw a CompileError to avoid crashing.

Fixes #6338.

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.

assert in type_check_encode_buffer_empty was causing the compiler to crash.

We now throw a CompileError to avoid crashing.

Fixes #6338.
@esdrubal esdrubal added bug Something isn't working compiler: frontend Everything to do with type checking, control flow analysis, and everything between parsing and IRgen labels Aug 6, 2024
@esdrubal esdrubal self-assigned this Aug 6, 2024
Copy link

github-actions bot commented Aug 6, 2024

Benchmark for 204ebcd

Click to view benchmark
Test Base PR %
code_action 5.2±0.07ms 5.3±0.09ms +1.92%
code_lens 299.7±8.57ns 297.3±5.61ns -0.80%
compile 2.6±0.06s 2.7±0.04s +3.85%
completion 4.7±0.03ms 4.9±0.13ms +4.26%
did_change_with_caching 2.7±0.04s 2.7±0.07s 0.00%
document_symbol 881.5±29.54µs 860.8±25.21µs -2.35%
format 71.4±0.75ms 72.9±0.75ms +2.10%
goto_definition 344.2±8.26µs 361.1±12.14µs +4.91%
highlight 9.0±0.09ms 9.1±0.30ms +1.11%
hover 494.9±11.49µs 527.2±7.16µs +6.53%
idents_at_position 120.6±0.55µs 118.0±0.77µs -2.16%
inlay_hints 669.1±16.89µs 658.4±23.80µs -1.60%
on_enter 2.2±0.17µs 2.1±0.05µs -4.55%
parent_decl_at_position 3.7±0.01ms 3.8±0.12ms +2.70%
prepare_rename 341.1±5.90µs 355.5±8.78µs +4.22%
rename 9.3±0.01ms 9.3±0.13ms 0.00%
semantic_tokens 1214.9±10.07µs 1303.3±21.24µs +7.28%
token_at_position 333.5±2.25µs 352.6±3.21µs +5.73%
tokens_at_position 3.7±0.02ms 3.8±0.11ms +2.70%
tokens_for_file 397.4±2.13µs 411.1±4.29µs +3.45%
traverse 38.6±0.84ms 38.0±0.45ms -1.55%

@esdrubal esdrubal marked this pull request as ready for review August 7, 2024 12:37
@esdrubal esdrubal requested a review from a team as a code owner August 7, 2024 12:37
@IGI-111 IGI-111 enabled auto-merge (squash) August 7, 2024 13:08
@IGI-111 IGI-111 merged commit a906afa into master Aug 7, 2024
35 checks passed
@IGI-111 IGI-111 deleted the esdrubal/6338 branch August 7, 2024 13:22
Copy link

github-actions bot commented Aug 7, 2024

Benchmark for 334fdd1

Click to view benchmark
Test Base PR %
code_action 5.1±0.01ms 5.2±0.10ms +1.96%
code_lens 291.8±7.35ns 285.5±8.88ns -2.16%
compile 2.6±0.05s 2.6±0.04s 0.00%
completion 4.6±0.01ms 4.6±0.03ms 0.00%
did_change_with_caching 2.6±0.03s 2.6±0.02s 0.00%
document_symbol 915.9±19.15µs 848.7±25.55µs -7.34%
format 72.3±0.91ms 72.1±0.64ms -0.28%
goto_definition 338.3±10.63µs 336.1±6.38µs -0.65%
highlight 8.9±0.14ms 8.9±0.02ms 0.00%
hover 488.6±6.20µs 488.0±4.08µs -0.12%
idents_at_position 118.6±0.58µs 118.7±0.52µs +0.08%
inlay_hints 632.1±23.96µs 634.5±15.66µs +0.38%
on_enter 2.1±0.06µs 2.0±0.04µs -4.76%
parent_decl_at_position 3.7±0.05ms 3.7±0.15ms 0.00%
prepare_rename 334.7±8.69µs 339.0±9.99µs +1.28%
rename 9.3±0.11ms 9.3±0.17ms 0.00%
semantic_tokens 1146.4±25.97µs 1227.2±15.88µs +7.05%
token_at_position 331.9±4.16µs 334.5±1.97µs +0.78%
tokens_at_position 3.7±0.05ms 3.7±0.03ms 0.00%
tokens_for_file 395.5±2.55µs 397.7±4.17µs +0.56%
traverse 37.0±0.70ms 37.6±1.06ms +1.62%

esdrubal added a commit that referenced this pull request Aug 13, 2024
## Description

Assert in type_check_encode_buffer_empty was causing the compiler to
crash.

We now throw a CompileError to avoid crashing.

Fixes #6338.

## Checklist

- [x] I have linked to any relevant issues.
- [x] 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).
- [ ] 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
bug Something isn't working compiler: frontend Everything to do with type checking, control flow analysis, and everything between parsing and IRgen
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sway compiler crash with assertion failure when compile intrinsic function in type_check_encode_buffer_empty
3 participants