Skip to content

fix(ir/validator): fix crash + typos in validator.rs#104

Open
Dhakshin2007 wants to merge 1 commit intogoogle:mainfrom
Dhakshin2007:patch-1
Open

fix(ir/validator): fix crash + typos in validator.rs#104
Dhakshin2007 wants to merge 1 commit intogoogle:mainfrom
Dhakshin2007:patch-1

Conversation

@Dhakshin2007
Copy link
Copy Markdown

  1. BUG FIX (crash): validate_no_branch_in_the_middle_of_block_instructions() calls block.instructions[0..block.instructions.len() - 1] which panics in debug mode (integer underflow) when block.instructions is empty. Fixed by using .saturating_sub(1) so that an empty slice is returned for empty instruction lists.

  2. fix typo: "consition" -> "condition" in validate_if_condition_is_bool error message (introduced in commit 90fb0aa)

  3. fix typo: "variabls" -> "variables" in validate_all_ids_are_present_in_block error message

  4. fix typo: "at lease 1" -> "at least 1" in OpCode::Switch validation error message

  5. fix typo: "paird" -> "paired" in TODO comment

1. BUG FIX (crash): validate_no_branch_in_the_middle_of_block_instructions() calls
   block.instructions[0..block.instructions.len() - 1] which panics in debug mode
   (integer underflow) when block.instructions is empty. Fixed by using
   .saturating_sub(1) so that an empty slice is returned for empty instruction lists.

2. fix typo: "consition" -> "condition" in validate_if_condition_is_bool error message
   (introduced in commit 90fb0aa)

3. fix typo: "variabls" -> "variables" in validate_all_ids_are_present_in_block error
   message

4. fix typo: "at lease 1" -> "at least 1" in OpCode::Switch validation error message

5. fix typo: "paird" -> "paired" in TODO comment
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.

1 participant