llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.41k stars 12.15k forks source link

Misleading location in "elements literal must be ranked tensor of vector type" error #45879

Open jurahul opened 4 years ago

jurahul commented 4 years ago
Bugzilla Link 46534
Version unspecified
OS All
CC @jpienaar,@River707

Extended Description

When this error is generated, the parser has parsed the entire statement and moved to the next statement in the file, so the error generated (in parseElementsLiteralType end up pointing to a line after the line containing the problematic code.

For example:

func @​test() -> f32 { %cst = constant dense<33.0> : f32 return %cst : f32 }

Flags the return with this error message.

May be we can keep track of the location of the type parsed in the earlier line and use that when printing this error message?

joker-eph commented 3 years ago

WDYT River?

jurahul commented 4 years ago

assigned to @River707