Regression test for optimizing which used to be
too aggresive in removing instanceof checks.