New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for type expressions in intersections #7172
Conversation
7f1a534
to
1fa6954
Compare
7dd4412
to
5ba0bf1
Compare
edb/edgeql/compiler/schemactx.py
Outdated
@@ -30,6 +30,8 @@ | |||
Union, | |||
Iterable, | |||
Sequence, | |||
List, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are on Python 3.11+ so prefer using builtin types instead, e.g list[foo]
instead of List[foo]
852cabf
to
12cae6b
Compare
e3bbcb6
to
7e90ca9
Compare
5e114aa
to
418b2d1
Compare
50e8b56
to
9db9b8d
Compare
418b2d1
to
6a51455
Compare
3a3979a
to
a455852
Compare
6a51455
to
c55425b
Compare
0ac4824
to
371cbfa
Compare
7a5f0c0
to
3be2fea
Compare
371cbfa
to
53858c7
Compare
3be2fea
to
a8de853
Compare
96edc3d
to
a71ed0f
Compare
a8de853
to
759123d
Compare
a71ed0f
to
7ce8da7
Compare
edb/edgeql/compiler/schemactx.py
Outdated
if ( | ||
left.get_is_opaque_union(ctx.env.schema) | ||
and (left_union := left.get_union_of(ctx.env.schema)) | ||
): | ||
left = get_union_type(left_union.objects(ctx.env.schema), ctx=ctx) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The opaque union stuff really is dodgy in general. Does this represent a change of behavior, or are we doing basically what we were before for opaque unions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In particular, I think that intersecting with an opaque union really ought to just produce the intersector type---but the reason we don't want that is for implementation purposes, IIRC?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Always producing intersections here causes issues when compiling the standard library because it tries to create an intersection TypeShell
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good, pending some follow-ups on opaque unions.
Let's make sure we understand exactly what the behavior is there, what we want, and have it documented where we are applying the intersections.
Great work on this!
Classic onboarding rabbit hole.
I'm happy I never did it during my first months :)
edb/schema/objects.py
Outdated
@@ -3147,6 +3148,7 @@ def _issubclass( | |||
self, | |||
schema: s_schema.Schema, | |||
parent: SubclassableObject, | |||
**kwargs: Any, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should just pass through the arguments with defaults everywhere. (Sorry)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems unpacking opaque unions and views as thoroughly as I initially attempted is not necessary. I've removed the kwargs entirely.
43a9a86
to
a879d65
Compare
a879d65
to
fea2cc0
Compare
57e6d50
to
fea2cc0
Compare
Allow '|' and '&' in intersections.
Examples using the advanced types database: