Add more exhaustive tests for .asTypeOf (#4160) (#4169)

This includes changing AsTypeOfSpec to be FunSpec instead of FlatSpec
so that the tests can have more structure.

(cherry picked from commit 2997fa87)

Co-authored-by: Jack Koenig <koenig@sifive.com>
9 jobs for 6.x
in 0 seconds and was queued for 62 minutes and 22 seconds
latest Auto DevOps