Problem
Issue #155 established a metadata-driven mechanism for projecting selected upstream TypeInterface records into member-bearing C# interfaces via MLIR.NET extends overlays, and for letting generated TypeDef classes satisfy those members through matching generated properties or explicit implementation expressions.
That mechanism is currently limited to TypeInterface and generated TypeDef classes. Upstream AttrInterface records are still treated as marker-only metadata in generated C#.
This leaves a gap for attribute-oriented interfaces whose getter-like API should surface as real C# members on generated AttrDef classes.
Proposed Change
Extend the interface overlay/import/generation pipeline to support AttrInterface records and generated AttrDef classes.
Specifically:
- import
MLIRNet_InterfaceExtension metadata on AttrInterface records into the ODS model;
- emit member-bearing partial C# interfaces for mapped
AttrInterface records, while preserving marker-only emission when no csharpMembers are present;
- teach generated
AttrDef classes to satisfy mapped interface members by:
- reusing compatible generated public members when they already exist;
- otherwise emitting members from explicit
csharpInterfaceImplementations overlay expressions;
- otherwise producing a clear generator diagnostic.
The implementation should reuse the generic overlay-based mechanism introduced for type interfaces, not introduce per-interface generator branches.
Design Principles
- Keep the mechanism generic and metadata-driven.
- Do not special-case specific upstream attribute interfaces in the generator.
- Preserve marker-only behavior for unmapped interfaces.
- Prefer property mappings for getter-like upstream methods.
- Keep generated interfaces
partial so handwritten extensions remain possible.
- Preserve existing generated attribute behavior when no interface mapping is present.
Out Of Scope
- Operation interface support.
- Automatic translation of arbitrary C++ interface signatures to C#.
- Runtime verification of interface constraints.
- Handwritten runtime attribute types outside generated
AttrDef output.
- Mapped interface methods with parameters; this issue is primarily about carrying the current property-focused mechanism over to attributes.
Acceptance Criteria
AttrInterface records can carry MLIRNet_InterfaceExtension metadata through import.
- Generated C# emits member-bearing partial interfaces for mapped
AttrInterface records.
- Generated
AttrDef classes reuse compatible generated members when they already satisfy the mapped contract.
- Generated
AttrDef classes emit explicit implementation members from csharpInterfaceImplementations when needed.
- Missing implementations for mapped attribute interfaces produce a clear diagnostic.
- Add importer and generator tests using a small local attribute interface and attr def.
- Preserve existing marker-only behavior for unmapped
AttrInterface records.
Problem
Issue #155 established a metadata-driven mechanism for projecting selected upstream
TypeInterfacerecords into member-bearing C# interfaces via MLIR.NETextendsoverlays, and for letting generatedTypeDefclasses satisfy those members through matching generated properties or explicit implementation expressions.That mechanism is currently limited to
TypeInterfaceand generatedTypeDefclasses. UpstreamAttrInterfacerecords are still treated as marker-only metadata in generated C#.This leaves a gap for attribute-oriented interfaces whose getter-like API should surface as real C# members on generated
AttrDefclasses.Proposed Change
Extend the interface overlay/import/generation pipeline to support
AttrInterfacerecords and generatedAttrDefclasses.Specifically:
MLIRNet_InterfaceExtensionmetadata onAttrInterfacerecords into the ODS model;AttrInterfacerecords, while preserving marker-only emission when nocsharpMembersare present;AttrDefclasses to satisfy mapped interface members by:csharpInterfaceImplementationsoverlay expressions;The implementation should reuse the generic overlay-based mechanism introduced for type interfaces, not introduce per-interface generator branches.
Design Principles
partialso handwritten extensions remain possible.Out Of Scope
AttrDefoutput.Acceptance Criteria
AttrInterfacerecords can carryMLIRNet_InterfaceExtensionmetadata through import.AttrInterfacerecords.AttrDefclasses reuse compatible generated members when they already satisfy the mapped contract.AttrDefclasses emit explicit implementation members fromcsharpInterfaceImplementationswhen needed.AttrInterfacerecords.