forked from M-Labs/artiq
Fix ff3206be
.
This commit is contained in:
parent
ff3206be07
commit
df91500f68
|
@ -394,8 +394,7 @@ class StitchingInferencer(Inferencer):
|
|||
IntMonomorphizer(engine=proxy_engine).visit(ast)
|
||||
attr_value_type = ast.type
|
||||
|
||||
if is_method:
|
||||
assert types.is_function(attr_value_type)
|
||||
if is_method and types.is_rpc_function(attr_value_type):
|
||||
self_type = list(attr_value_type.args.values())[0]
|
||||
self._unify(object_type, self_type,
|
||||
node.loc, None)
|
||||
|
|
|
@ -851,8 +851,11 @@ class ARTIQIRGenerator(algorithm.Visitor):
|
|||
if self.current_assign is None:
|
||||
return self.append(ir.GetAttr(obj, node.attr,
|
||||
name="{}.{}".format(_readable_name(obj), node.attr)))
|
||||
elif types.is_rpc_function(self.current_assign.type):
|
||||
# RPC functions are just type-level markers
|
||||
return self.append(ir.Builtin("nop", [], builtins.TNone()))
|
||||
else:
|
||||
self.append(ir.SetAttr(obj, node.attr, self.current_assign))
|
||||
return self.append(ir.SetAttr(obj, node.attr, self.current_assign))
|
||||
|
||||
def _map_index(self, length, index, one_past_the_end=False, loc=None):
|
||||
lt_0 = self.append(ir.Compare(ast.Lt(loc=None),
|
||||
|
|
|
@ -28,7 +28,7 @@ class MonomorphismValidator(algorithm.Visitor):
|
|||
super().generic_visit(node)
|
||||
|
||||
if isinstance(node, asttyped.commontyped):
|
||||
if types.is_polymorphic(node.type):
|
||||
if types.is_polymorphic(node.type) and not types.is_rpc_function(node.type):
|
||||
note = diagnostic.Diagnostic("note",
|
||||
"the expression has type {type}",
|
||||
{"type": types.TypePrinter().name(node.type)},
|
||||
|
|
Loading…
Reference in New Issue