forked from M-Labs/artiq
Better error reporting for List.
This commit is contained in:
parent
4b7d4c2425
commit
e18ea0daae
|
@ -268,9 +268,9 @@ class Inferencer(algorithm.Transformer):
|
|||
def makenotes(printer, typea, typeb, loca, locb):
|
||||
return [
|
||||
diagnostic.Diagnostic("note",
|
||||
"a list of type {typea}",
|
||||
{"typea": printer.name(node.type)},
|
||||
loca),
|
||||
"a list element of type {typea}",
|
||||
{"typea": printer.name(node.elts[0].type)},
|
||||
node.elts[0].loc),
|
||||
diagnostic.Diagnostic("note",
|
||||
"a list element of type {typeb}",
|
||||
{"typeb": printer.name(typeb)},
|
||||
|
|
|
@ -9,7 +9,7 @@ a = b
|
|||
|
||||
# CHECK-L: ${LINE:+1}: error: cannot unify int(width='a) with list(elt='b)
|
||||
[1, []]
|
||||
# CHECK-L: note: a list of type list(elt=int(width='a))
|
||||
# CHECK-L: note: a list element of type int(width='a)
|
||||
# CHECK-L: note: a list element of type list(elt='b)
|
||||
|
||||
# CHECK-L: ${LINE:+1}: error: cannot unify int(width='a) with bool
|
||||
|
|
Loading…
Reference in New Issue