Skip to content

Enum Conversions are Incorrect #209

@JasonBock

Description

@JasonBock

To reproduce:

public enum Values { One, Two, Three };

public interface IValues
{
  public void Go(Values values = Values.Three);
}

public static class Test
{
  public static void Go()
  {
    var expectations = Rock.Create<IValues>();
  }
}

This will create two errors:

Error - Id: CS1503, Description: Rocks\Rocks.RockCreateGenerator\IValues_Rock_Create.g.cs(74,205): error CS1503: Argument 1: cannot convert from 'int' to 'Values'
Error - Id: CS1750, Description: Rocks\Rocks.RockCreateGenerator\IValues_Rock_Create.g.cs(33,33): error CS1750: A value of type 'int' cannot be used as a default parameter because there are no standard conversions to type 'Values'

Rocks will just put in the value of the enum, because I think I found it a bit hard to get the enum name. If I can do that, the errors should go away.

This was found with StackExchange.Redis.IBatch.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions