<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/55324>55324</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Attributes with a self type parameter cannot use declarative assembly
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            mlir:core
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          stellaraccident
      </td>
    </tr>
</table>

<pre>
    In the test dialect, we have a self-type attribute:

```
// An attribute testing AttributeSelfTypeParameter.
def AttrWithSelfTypeParam : Test_Attr<"AttrWithSelfTypeParam"> {
  let mnemonic = "attr_with_self_type_param";
  let parameters = (ins AttributeSelfTypeParameter<"">:$type);
  let hasCustomAssemblyFormat = 1;
}
```

This prints as:

```
#test<"attr_with_self_type_param i32">
```

It was noted on https://reviews.llvm.org/D124318 that when using declarative assembly, we should not include the self type, but it is unclear what else to do. As an example:

```
def MLProgram_ExternAttr : MLProgram_Attr<"Extern"> {
  let parameters = (ins AttributeSelfTypeParameter<"">:$type);
  let mnemonic = "extern";
  let assemblyFormat = "`<` $type `>`";
}
```

This does indeed work and prints as `#ml_program.extern<i32>`. What I really want is something like the builtin syntax: `#ml_program.extern : i32` but that appears impossible with either declarative or custom printer/parser.

Can we confirm that the above is WAI, and if so, add a corresponding test case to the test dialect showing use of custom assembly with a self type attribute. Separately, can we confirm that the prettier format I really want cannot be done?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy1lctu2zoQhp9G2gwqyJTly0IL146BAC1QoAGyNChxbLGlSIGk4vjtO6R8OU6T024KCLQuw7n9H8e1EafqUYNvETw6D0JyhY1P2BqOCC1_QeDgUO0_-VNP995bWQ8ek2KV5Jskv6yz_HyNj2xLF6z0bUN0L_UBVpc338nrEzn9xi3v0KPNxs0C99HoWfr2zgYoKDyRm134nBTrhLF3Del9UjxAMv88egRQ6KHT2BktG3KzATIJ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