Commit Graph

3 Commits

Author SHA1 Message Date
Kavon Farvardin
a5c8a6252e Test: run reflection test only on host 2024-07-16 07:51:42 -07:00
Kavon Farvardin
ec2a72e6f9 Test: add missing codesign step 2024-07-16 00:43:24 -07:00
Kavon Farvardin
d755e90236 NCGenerics: limit field metadata heuristic
We have had a heuristic that lets you reflect fields of types, where
the field's type is conditionally Copyable, despite the reflection
infrastructure always copying a field. That heuristic was added to allow
ubiquitous types like Optional in the stdlib to continue to be
reflected, even if the Optional at runtime really isn't Copyable.

As a consequence, we were also allowing reflection of fields containing
user-defined conditionally copyable types, when that's unsafe for no
real benefit, yielding runtime crashes!

I think in that case it's better to fall-back on the non-crashy case of
reflection seeing it as the EmptyTupleType, which isn't inhabited, so it
won't try to copy the field and instead basically skip-over it until a
future runtime supports the reflection safely.

So, this patch limits the dangerous reflection to only stdlib-defined
types, until Mirror and friends are updated.
2024-07-15 22:10:17 -07:00