From e18ea0daae6b7046b02cbab2284fb3fd378c3d00 Mon Sep 17 00:00:00 2001 From: whitequark Date: Thu, 11 Jun 2015 04:22:31 +0300 Subject: [PATCH] Better error reporting for List. --- artiq/py2llvm/typing.py | 6 +++--- lit-test/py2llvm/typing/error_unify.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/artiq/py2llvm/typing.py b/artiq/py2llvm/typing.py index a9ab62ffa..fe5c2c800 100644 --- a/artiq/py2llvm/typing.py +++ b/artiq/py2llvm/typing.py @@ -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)}, diff --git a/lit-test/py2llvm/typing/error_unify.py b/lit-test/py2llvm/typing/error_unify.py index a1e8b1d8e..1140ba61f 100644 --- a/lit-test/py2llvm/typing/error_unify.py +++ b/lit-test/py2llvm/typing/error_unify.py @@ -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