-
Notifications
You must be signed in to change notification settings - Fork 184
Description
It's possible that a new answer may not be ambiguous, but an older answer was. In this case push_answer
on Table
does not insert a new answer, but still returns true
.
chalk/chalk-engine/src/table.rs
Line 107 in 3ef2030
let added = match self.answers_hash.entry(answer.subst.clone()) { |
However, if true
is returned, then it's propagated up and eventually the AnswerIndex
is incremented
chalk/chalk-engine/src/forest.rs
Line 231 in 3ef2030
self.answer.increment(); |
Then, in the next iteration of checking for an answer, the AnswerIndex
is not the next index, so this assertion can fail:
chalk/chalk-engine/src/logic.rs
Line 194 in 3ef2030
assert_eq!(self.tables[table].next_answer_index(), answer); |
Simply changing push_answer
to panic whenever a new answer would replace an old one doesn't cause any tests to fail. So if this is a valid case, then a test should be added.
Relevant zulip: https://rust-lang.zulipchat.com/#narrow/stream/144729-wg-traits/topic/design.20meeting.202019.2E12.2E02/near/182380076