do not try to find casts when types are unknown (closes #2041)
disallow static constructor when class is typed (closes #2037)