mirror of https://github.com/m-labs/artiq.git
embedding: unify all derived attribute types.
This commit is contained in:
parent
f52d364806
commit
6938036b28
|
@ -402,18 +402,21 @@ class StitchingInferencer(Inferencer):
|
||||||
if node.attr not in attributes:
|
if node.attr not in attributes:
|
||||||
# We just figured out what the type should be. Add it.
|
# We just figured out what the type should be. Add it.
|
||||||
attributes[node.attr] = attr_value_type
|
attributes[node.attr] = attr_value_type
|
||||||
elif attributes[node.attr] != attr_value_type and not types.is_rpc_function(attr_value_type):
|
elif not types.is_rpc_function(attr_value_type):
|
||||||
# Does this conflict with an earlier guess?
|
# Does this conflict with an earlier guess?
|
||||||
# RPC function types are exempt because RPCs are dynamically typed.
|
# RPC function types are exempt because RPCs are dynamically typed.
|
||||||
printer = types.TypePrinter()
|
try:
|
||||||
diag = diagnostic.Diagnostic("error",
|
attributes[node.attr].unify(attr_value_type)
|
||||||
"host object has an attribute '{attr}' of type {typea}, which is"
|
except types.UnificationError as e:
|
||||||
" different from previously inferred type {typeb} for the same attribute",
|
printer = types.TypePrinter()
|
||||||
{"typea": printer.name(attr_value_type),
|
diag = diagnostic.Diagnostic("error",
|
||||||
"typeb": printer.name(attributes[node.attr]),
|
"host object has an attribute '{attr}' of type {typea}, which is"
|
||||||
"attr": node.attr},
|
" different from previously inferred type {typeb} for the same attribute",
|
||||||
object_loc)
|
{"typea": printer.name(attr_value_type),
|
||||||
self.engine.process(diag)
|
"typeb": printer.name(attributes[node.attr]),
|
||||||
|
"attr": node.attr},
|
||||||
|
object_loc)
|
||||||
|
self.engine.process(diag)
|
||||||
|
|
||||||
super().visit_AttributeT(node)
|
super().visit_AttributeT(node)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue