Issue 11383 - Some array casts incorrectly rejected in safe code

The existing rules banned non-mutable -> mutable and non-shared -> shared, but that was too strict.  That restriction is only necessary for classes, due to the implicit reference.

Move modifier check into class-only code and add tests.

https://d.puremagic.com/issues/show_bug.cgi?id=11383