(If there is indeed a bug here, that probably means it's worth adding a test case with more than 2 consecutive ambiguous matches.)