-
Notifications
You must be signed in to change notification settings - Fork 367
Fix Issue #414 - NullableExpressionVisitor improvement #788
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
base: development
Are you sure you want to change the base?
Conversation
@andrerav @stagep Because the expected behavior in Nullable aware context was actually working by mistake (In the example, the error should occur in both cases.). Which path should we follow:
Example :
|
@DocSvartz @andrerav Looking at my own code generated mappings, it always checks the reference type is not null before it proceeds to map properties of the reference type. Is this the behavior that you are referring to that was implemented "by mistake"? |
code which is currently being created from first case:
code which is currently being created from second case:
The problem here is that both the first and second options when describing a type in a nullable aware context (#nullable enable) have never been null. And NullabilityInfoContext will indeed define it as not null in both cases. It can also take into account other nullable attributes.
If you mean Mapster Tool. Then source generators by default create code of #nullable disable context. Viewing the code of what happens during normal mapping is better done like this |
@stagep @andrerav Mapster for the most part, it does not analyze the runtime state of variables. It creates mapping functions based on the Source and Destination types. I am not against the existence of behavior "by design", That's why I'm asking what we will stick to. |
@DocSvartz Have been busy so not got to look at this. What version or branch of Mapster are you using in the above example? I see you have forked this repository so do I need to use a branch of your repository? |
@stagep everything I described happens on any version. Current tests do not use nullable context. To notice this, you need to use |
Fix Issue #414