Skip to content

Document C# extension: [return: attribute] on accessor that returns void #62145

@KalleOlaviNiemitalo

Description

@KalleOlaviNiemitalo

The Roslyn C# compiler allows a return attribute_target_specifier in the following contexts, where ECMA-334 5th edition § 22.3 (Attribute specification) does not allow it:

  • add accessor of an event
  • remove accessor of an event
  • set accessor of a property
  • set accessor of an indexer

Please document this extension, to comply with ECMA-334 5th edition chapter 2:

A conforming implementation of C# shall be accompanied by a document that defines all implementation-defined characteristics, and all extensions.

The feature used to be documented at https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/attributes#attribute-specification, but it was not marked as an extension, and anyway has been removed from that document, which now comes from an ECMA C# draft.

I imagine the extension could be documented in https://github.com/dotnet/roslyn/tree/main/docs/compilers/CSharp, which already describes some other extensions (if a directory can be considered "a document"), or perhaps in https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/attributes/.

Split from dotnet/csharpstandard#340.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions