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

Avoid accessing inactive union fields in completeDot #1115

Merged
merged 1 commit into from
Apr 5, 2023

Conversation

llogick
Copy link
Contributor

@llogick llogick commented Apr 5, 2023

As reported on Discord by CodotakuYT:

fn populate(T: type, index: i32) T {
    _ = index;
    @typeInfo(T).struct.
}
thread 17384 panic: access of union field 'ast_node' while field 'param_payload' is active
C:\Users\taoua\zls\src\features\completions.zig:875:61: 0x7ff68070caac in completeDot (zls.exe.obj)
                const node_data = nodes_data[local_decl.decl.ast_node];

As reported on Discord by CodotakuYT:
```zig
fn populate(T: type, index: i32) T {
    _ = index;
    @typeinfo(T).struct.
}
```
```
thread 17384 panic: access of union field 'ast_node' while field 'param_payload' is active
C:\Users\taoua\zls\src\features\completions.zig:875:61: 0x7ff68070caac in completeDot (zls.exe.obj)
                const node_data = nodes_data[local_decl.decl.ast_node];
```
Copy link
Member

@SuperAuguste SuperAuguste left a comment

Choose a reason for hiding this comment

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

LGTM

@SuperAuguste SuperAuguste merged commit 55b1aeb into zigtools:master Apr 5, 2023
@llogick llogick deleted the crash-in-completeDot branch April 5, 2023 17:26
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.

2 participants