[mypyc] Add LoadAddress primitive op for PySet_Type & PyFrozenSet_Type #13057
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This also fixes mypyc/mypyc#917.
RE above, the root issue is that mypyc didn't know builtins.set was a built-in name, so it guessed it comes from the module globals. This didn't blow up anything up somehow... until the dataclasses commit (1bcfc04) which made the
__annotations__
logic for dataclasses try to better preserve the type annotations (previously they would be erased to builtins.type). This new logic would useload_type
to loadbuiltins.set
(so it can be put in__annotations__
) which went poorly as only types registered withload_address_op
are considered built-ins.Test Plan
I added a run test sub-case that tests a generic built-in type (i.e.
set
) is stored correctly in the dataclass'__annotations__
.