Skip to content
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

fix the nullable value type #3567

Merged

Conversation

ArcturusZhang
Copy link
Member

@ArcturusZhang ArcturusZhang commented Jun 12, 2024

Fixes Azure/autorest.csharp#4678

We are only checking if the input type is a generic type, and then get its generic argument if it is.
We are not checking if it is this special generic type System.Nullable<T> which appears to be a generic type but we actually want it to be non-generic but nullable.

This PR changes the final constructor that would be invoke for all cases that a ctor of CSharpType from a System.Type to add a check if it is System.Nullable<T>, we will use T as _type, and the arguments of T as the real arguments.

@ArcturusZhang ArcturusZhang added the emitter:client:csharp Issue for the C# client emitter: @typespec/http-client-csharp label Jun 12, 2024
@azure-sdk
Copy link
Collaborator

API change check

API changes are not detected in this pull request.

@ArcturusZhang ArcturusZhang added this pull request to the merge queue Jun 12, 2024
Merged via the queue into microsoft:main with commit 913aa03 Jun 12, 2024
21 checks passed
@ArcturusZhang ArcturusZhang deleted the fix-the-nullable-value-type-issue branch June 12, 2024 05:29
ArcturusZhang added a commit to Azure/autorest.csharp that referenced this pull request Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
emitter:client:csharp Issue for the C# client emitter: @typespec/http-client-csharp
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Inconsistency happens when CSharpType is created from System.Nullable<T>
3 participants