Make the typevar map passed to substitute be const