Interplay of acidity and ionic liquid structure on the outcome of a heterocyclic rearrangement reaction