os << '{';
interleaveComma(attr.cast<DictionaryAttr>().getValue(),
[&](NamedAttribute attr) {
- os << attr.first << " = ";
+ os << attr.first;
+
+ // The value of a UnitAttr is elided within a dictionary.
+ if (attr.second.isa<UnitAttr>())
+ return;
+
+ os << " = ";
printAttribute(attr.second);
});
os << '}';
// CHECK-LABEL: func @unitAttrs
func @unitAttrs() -> () {
- // CHECK-NEXT: "foo"() {unitAttr} : () -> ()
+ // CHECK-NEXT: "foo"() {unitAttr}
"foo"() {unitAttr = unit} : () -> ()
- // CHECK-NEXT: "foo"() {unitAttr} : () -> ()
+ // CHECK-NEXT: "foo"() {unitAttr}
"foo"() {unitAttr} : () -> ()
+
+ // CHECK-NEXT: "foo"() {nested = {unitAttr}}
+ "foo"() {nested = {unitAttr}} : () -> ()
return
}