Conversation
Currently, doing `==` on arrays fails at runtime with ``` AttributeError: type object 'Array[models.__sharedstd__.__shapes__.std.uuid]' has no attribute '__gel_type_class__' ``` and produces a `bool` at typecheck time instead of a `type[std.bool]`. My approach to fixing this is to replace uses of `Array` with `std.array`, which has a `__gel_type_class__` and all the appropriate overloadings. When I extend this approach to other similar types, though, like `Range`, I run into problems: the `typing_dispatch` based overloaded constructor for range always fails when doing a `Type.model_validate(r.model_dump())`, in part because the overloads all seem to want want `std.bool` and won't accept real bools. @elprans Does this seem like the right approach, and I should continue down this path and fix any problems in the way (like those mentioned above), or do you think I'm on the wrong track here?
Member
yeah, that's how I would do it |
elprans
approved these changes
Sep 30, 2025
msullivan
added a commit
that referenced
this pull request
Oct 3, 2025
Generate `std.range`/`std.tuple`, follownig the approach of #939. Then, fix calling functions in QB when range[_T_anypoint] or array[_T_anytype] used, by specifically checking ParametricType subclasses against GenericAlias[T].
msullivan
added a commit
that referenced
this pull request
Oct 3, 2025
Generate `std.range`/`std.tuple`, follownig the approach of #939. Then, fix calling functions in QB when range[_T_anypoint] or array[_T_anytype] used, by specifically checking ParametricType subclasses against GenericAlias[T].
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Currently, doing
==on arrays fails at runtime withand produces a
boolat typecheck time instead of atype[std.bool].My approach to fixing this is to replace uses of
Arraywithstd.array, which has a__gel_type_class__and all the appropriateoverloadings.
When I extend this approach to other similar types, though, like
Range, I run into problems: thetyping_dispatchbased overloadedconstructor for range always fails when doing a
Type.model_validate(r.model_dump()), in part because the overloadsall seem to want want
std.booland won't accept real bools.@elprans Does this seem like the right approach, and I should continue
down this path and fix any problems in the way (like those mentioned
above), or do you think I'm on the wrong track here?