fix dropping non-primitive immediates

Closes #9446