Skip to content

Commit

Permalink
fix: #127 self-reference endless recursion
Browse files Browse the repository at this point in the history
It seems that his simple hash correction fixes the endless recursion.
  • Loading branch information
phorward committed Jul 6, 2024
1 parent a62a2a0 commit 0e17b59
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/compiler/iml/imlvalue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ impl std::hash::Hash for ImlValue {
}
Self::Parselet(parselet) => {
state.write_u8('p' as u8);
parselet.hash(state);
parselet.borrow().id().hash(state);
}
other => unreachable!("{:?} is unhashable", other),
}
Expand Down
3 changes: 1 addition & 2 deletions tests/parselet_generic_selfref.tok
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ Assignment : @<Expression, Assignment: Assignment, ext: void> {
Expression ast("value")
}

# HoldAssignment : Assignment<Int, HoldAssignment> # fails with endless recursion!
HoldAssignment : Assignment<Int, HoldAssignment> Empty # workaround!
HoldAssignment : Assignment<Int, HoldAssignment>

# ast_print(Assignment<Int>)
ast_print(HoldAssignment)
Expand Down

0 comments on commit 0e17b59

Please sign in to comment.