parser.parseAttribute is called after parser.parseOptionalAttrDict and
by that moment attribute dictionary is already parsed, so it fails with
"error: expected attribute value".
It is not an option to leave parser.parseAttribute call only (remove
parser.parseOptionalAttrDict), because in this case it will parse
attribute dictionary as a whole, so resulting attribute would be
mlir::DictionaryAttr vs expected mlir::DenseElementsAttr deduced from
the first argument and fail with "error: custom op 'toy.constant'
invalid kind of attribute specified".
Signed-off-by: Gladilov, Gleb <gleb.gladilov@gmail.com>
In which situations is IR like this being created? The custom format of toy.constant should never place the value attribute in the dictionary, it should always be handled separately. The attribute dictionary handling is there to process other, non-explicitly specified, attributes.