2
0
mirror of https://github.com/m-labs/artiq.git synced 2024-12-25 03:08:27 +08:00
This commit is contained in:
whitequark 2015-12-30 15:16:05 +08:00
parent ff3206be07
commit df91500f68
3 changed files with 6 additions and 4 deletions

View File

@ -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)

View File

@ -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),

View File

@ -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)},