-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Labels
Area-Compilershelp wantedThe issue is "up for grabs" - add a comment if you are interested in working on itThe issue is "up for grabs" - add a comment if you are interested in working on it
Milestone
Description
There is a confusing error message when using in this
with an enum. For example, the below
public static class Ext
{
public static void M1(in this int i) { } //no error
public static void M2(this in MyEnum kind) { } //error!
}
public enum MyEnum : int
{
One
}
Produces
error CS8338: The first 'in' or 'ref readonly' parameter of the extension method 'M2' must be a concrete (non-generic) value type.
for M2
.
Its unclear to me exactly what the expected behaviour should be here - but if all types that are valid for enums are struct types, and if in this int
is allowed, then it follows that in this <some enum>
should also be allowed.
If MyEnum
is not allowed, it would be good to improve the error message.
Metadata
Metadata
Assignees
Labels
Area-Compilershelp wantedThe issue is "up for grabs" - add a comment if you are interested in working on itThe issue is "up for grabs" - add a comment if you are interested in working on it