Skip to content

Comments

Fix panic in remove_node for Definition nodes#190

Merged
fibonacci1729 merged 3 commits intobytecodealliance:mainfrom
sumleo:fix/remove-node-definition-name
Feb 17, 2026
Merged

Fix panic in remove_node for Definition nodes#190
fibonacci1729 merged 3 commits intobytecodealliance:mainfrom
sumleo:fix/remove-node-definition-name

Conversation

@sumleo
Copy link
Contributor

@sumleo sumleo commented Feb 12, 2026

Summary

  • Definition nodes store their name in the export field, not the name field (which is None)
  • The log::debug! in remove_node incorrectly used node.name.as_ref().unwrap(), which panics for Definition nodes
  • Changed to node.export.as_ref().unwrap(), matching the pattern already used in the Display impl

Test plan

  • Added unit test it_can_remove_a_type_definition that creates and removes a Definition node
  • All existing tests pass (cargo test --workspace)

Definition nodes store their name in the `export` field, not the `name`
field (which is None). The log::debug! in remove_node incorrectly used
`node.name.as_ref().unwrap()`, which panics for Definition nodes.
Changed to `node.export.as_ref().unwrap()`, matching the pattern used
elsewhere (e.g., the Display impl at line 1324).

Added a unit test that verifies remove_node works correctly for type
definition nodes.
Signed-off-by: Brian Hardock <brian.hardock@fermyon.com>
@fibonacci1729 fibonacci1729 merged commit 0ef84a3 into bytecodealliance:main Feb 17, 2026
7 checks passed
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