use `getfield` to access type fields in reflection
Should help avoid issues like #39534. Doesn't get every case of course, but should catch some common ones.
This seems rather icky, when it should do the same thing but with worse syntax (eventually perhaps we'll have sealed methods, and enforce it on these)
bump. should we triage or close this?
If we're going to do this, I would say we must also define that
getproperty(::Type, ::Symbol) = error("types are opaque")
Makes sense, that would just be quite breaking. This is not too important though so I'm fine to just leave things as-is.
Horribly outdated, but I do think it is in general worth using getfield explicitly in internal code on @nospecialized arguments, as it avoids the extra getproperty dispatch.