Coerce to trait type when setting properties.

This can slow down asSetProperty since the extra coercion is needed, but hopefully the verifier can eliminate some of this overhead.
Merge pull request #956 from mbebenita/master

Coerce to trait type when setting properties.