-
-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MapValueAttribute does not support mapping non-nullable constant values, to nullable properties of the same type #1534
Comments
Thanks for reporting. Feel free to contribute 😉 |
While reading the code I already fixed it: #1536 |
Fix released with |
@latonz [MapValue(nameof(Target.TheTarget), TargetEnum.Bar)) raised [MapValue(nameof(Target.TheTarget), Use = nameof(GetNullableTargetEnumValue)))
static partial Target Map(this Source source);
static TargetEnum? GetNullableTargetEnumValue() => TargetEnum.Bar; which is incorrect. |
@latonz thanks for your hard work - will wait for next |
Describe the bug
The following
incorrectly yields
but should result in no error and valid generated code, because a non-null value of a type is always assignable to a nullable value of the same type.
The below cannot be used as a workaround, as typecasts are not permitted in attributes.
The below is a valid workaround, but undesirable.
Environment (please complete the following information):
Additional context
#631
The text was updated successfully, but these errors were encountered: