-
Notifications
You must be signed in to change notification settings - Fork 88
Can not define implicit cast operator #502
Copy link
Copy link
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
In the readme, it is stated that you can provide implicit operators manually. When I try to provide one I get a compilation error
Duplicate user-defined conversion in type 'MyValue' - https://learn.microsoft.com/en-us/dotnet/csharp/misc/cs0557
The problem seems like you can not provide both implicit and explicit cast operator at the same time. However, Vogen automatically generates explicit cast operators.
Related Issue: #206
Related PR: #208
Steps to reproduce
Add the following code to an empty project and compile.
[ValueObject<int>]
public partial struct MyValue
{
public static implicit operator int(MyValue d) => 5;
}Expected behaviour
I should be able to provide implicit cast operator
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working