-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Don't generate nullable type when applying value type with unconstrained nullable generic #49154
Conversation
throw new System.NotImplementedException(); | ||
} | ||
}"); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we a few more tests.
- where T is unconstrained
- where T is constrained to
class
. - where T is unconstrained, and passed as T? to the base type
- where T is constrained to
class
, and passed as T? to the base type - where T is constrained to
struct
, and passed as T? to the base type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, make sure that other cases doesn't regress.
{ | ||
// value type with nullable annotation may be composed from unconstrained nullable generic | ||
// doesn't mean nullable value type in this case | ||
typeSyntax = AddInformationTo(SyntaxFactory.NullableType(typeSyntax), symbol); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about other named types that can be value types. like tuples. can you update as well (or add tests showing they're k).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are they special for this case? Here is adding top-level nullability, I couldn't imagine any type to have special semantics. The inner type has been handled above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
they're a named type that is a value type :) i just want to make sure it works properly and nothing unexpected happens.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding tests should be OK I think
Well, this is actually duplicated by #49242 . The corresponding issue can be closed now. |
@CyrusNajmabadi this has more test coverage than #49242 . Idea? |
You can reopen and just include the tests you want to add. Thanks! |
I think it's better to keep this PR, because it adds more comment and addresses another position. |
@CyrusNajmabadi Idea on this? Do you think it's worth to keep it? |
Azure Pipelines successfully started running 3 pipeline(s). |
Fixes #48742. Should prevent similar issue in other cases.