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 that unassign_variable error is reported many times unexpectedly #1157

Merged

Conversation

taichi-ishitani
Copy link
Contributor

@taichi-ishitani taichi-ishitani commented Dec 19, 2024

fix #1126

@taichi-ishitani taichi-ishitani marked this pull request as draft December 19, 2024 03:18
@taichi-ishitani taichi-ishitani force-pushed the many_unassign_variable_errors branch from 6119f10 to 2a77682 Compare December 19, 2024 03:29
@taichi-ishitani taichi-ishitani marked this pull request as ready for review December 19, 2024 03:30
@taichi-ishitani taichi-ishitani force-pushed the many_unassign_variable_errors branch from 2a77682 to 040a0b2 Compare December 19, 2024 03:35
&symbol.token.into(),
));
}
for (_, list) in self.var_refs.iter().filter(|(key, _)| {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This for seems to be too long. How about using tempolary value like below?

let var_refs = self.var_refs.iter().filter(...);
for (_, list) in var_refs {
}

let assign_list: Vec<_> = list.iter().filter(|(_i, x)| x.is_assign()).collect();
for (i, var_ref) in &list {
if let VarRefType::ExpressionTarget { r#type } = var_ref.r#type {
if matches!(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you give an appropriate name to the if condition?

@taichi-ishitani taichi-ishitani force-pushed the many_unassign_variable_errors branch from 040a0b2 to eaa0c13 Compare December 19, 2024 06:23
@taichi-ishitani
Copy link
Contributor Author

I fixed them.

@taichi-ishitani taichi-ishitani force-pushed the many_unassign_variable_errors branch from eaa0c13 to c1cefce Compare December 19, 2024 06:38
@dalance dalance merged commit 4a5e3bb into veryl-lang:master Dec 19, 2024
7 checks passed
@taichi-ishitani taichi-ishitani deleted the many_unassign_variable_errors branch December 19, 2024 06:51
@dalance dalance added this to the v0.13.4 milestone Dec 27, 2024
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.

Self-reference in always_comb causes many warnings in other files
2 participants