We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4b6bce2 commit d07a860Copy full SHA for d07a860
src/bloqade/geometry/dialects/grid/_typeinfer.py
@@ -14,10 +14,12 @@
14
class TypeInferMethods(MethodTable):
15
16
def get_len(self, typ: types.TypeAttribute):
17
- if typ.is_subseteq(ilist.IListType[types.Int, types.Any]):
18
- typ = cast(types.Generic, typ)
19
- if isinstance(typ.vars[1], types.Literal):
20
- return types.Literal(typ.vars[1].data + 1)
+ if (typ := cast(types.Generic, typ)).is_subseteq(
+ ilist.IListType
+ ) and isinstance(typ.vars[1], types.Literal):
+ # assume typ is Generic since it must be if it passes the first check
21
+ # and the second check is to ensure that the length is a literal
22
+ return types.Literal(typ.vars[1].data + 1)
23
24
return types.Any
25
0 commit comments