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

Avoid a LINQ usage in tensor extensions #109405

Merged
merged 4 commits into from
Oct 31, 2024
Merged

Avoid a LINQ usage in tensor extensions #109405

merged 4 commits into from
Oct 31, 2024

Conversation

am11
Copy link
Member

@am11 am11 commented Oct 31, 2024

This one, in particular, was causing an error with upcoming compiler changes (last one is the error):

/vmr/src/runtime/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/QCallHandles.cs(39,26): warning CS9265: Field 'ByteRef._ref' is never ref-assigned to, and will always have its default value (null reference) [/vmr/src/runtime/src/coreclr/System.Private.CoreLib/System.Private.CoreLib.csproj]
/vmr/src/runtime/src/libraries/System.Net.Http/src/System/Net/Http/Headers/HttpHeaders.cs(1168,30): warning CS8619: Nullability of reference types in value of type 'string[]' doesn't match target type 'Span<string?>'. [/vmr/src/runtime/src/libraries/System.Net.Http/src/System.Net.Http.csproj::TargetFramework=net10.0-linux]
/vmr/src/runtime/src/libraries/System.Net.Http/src/System/Net/Http/Headers/HttpHeaders.cs(1208,42): warning CS8620: Argument of type 'string[]' cannot be used for parameter 'values' of type 'Span<string?>' in 'void HttpHeaders.ReadStoreValues<object?>(Span<string?> values, object? storeValue, HttpHeaderParser? parser, ref int currentIndex)' due to differences in the nullability of reference types. [/vmr/src/runtime/src/libraries/System.Net.Http/src/System.Net.Http.csproj::TargetFramework=net10.0-linux]
/vmr/src/runtime/src/libraries/System.Net.Http/src/System/Net/Http/Headers/HttpHeaders.cs(1209,42): warning CS8620: Argument of type 'string[]' cannot be used for parameter 'values' of type 'Span<string?>' in 'void HttpHeaders.ReadStoreValues<string?>(Span<string?> values, object? storeValue, HttpHeaderParser? parser, ref int currentIndex)' due to differences in the nullability of reference types. [/vmr/src/runtime/src/libraries/System.Net.Http/src/System.Net.Http.csproj::TargetFramework=net10.0-linux]
/vmr/src/runtime/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/TensorExtensions.cs(2661,56): error CS0023: Operator '.' cannot be applied to operand of type 'void' [/vmr/src/runtime/src/libraries/System.Numerics.Tensors/src/System.Numerics.Tensors.csproj::TargetFramework=net10.0]
    4 Warning(s)
    1 Error(s)

This one, in particular, was causing an error with upcoming compiler changes:

    /vmr/src/runtime/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/QCallHandles.cs(39,26): warning CS9265: Field 'ByteRef._ref' is never ref-assigned to, and will always have its default value (null reference) [/vmr/src/runtime/src/coreclr/System.Private.CoreLib/System.Private.CoreLib.csproj]
    /vmr/src/runtime/src/libraries/System.Net.Http/src/System/Net/Http/Headers/HttpHeaders.cs(1168,30): warning CS8619: Nullability of reference types in value of type 'string[]' doesn't match target type 'Span<string?>'. [/vmr/src/runtime/src/libraries/System.Net.Http/src/System.Net.Http.csproj::TargetFramework=net10.0-linux]
    /vmr/src/runtime/src/libraries/System.Net.Http/src/System/Net/Http/Headers/HttpHeaders.cs(1208,42): warning CS8620: Argument of type 'string[]' cannot be used for parameter 'values' of type 'Span<string?>' in 'void HttpHeaders.ReadStoreValues<object?>(Span<string?> values, object? storeValue, HttpHeaderParser? parser, ref int currentIndex)' due to differences in the nullability of reference types. [/vmr/src/runtime/src/libraries/System.Net.Http/src/System.Net.Http.csproj::TargetFramework=net10.0-linux]
    /vmr/src/runtime/src/libraries/System.Net.Http/src/System/Net/Http/Headers/HttpHeaders.cs(1209,42): warning CS8620: Argument of type 'string[]' cannot be used for parameter 'values' of type 'Span<string?>' in 'void HttpHeaders.ReadStoreValues<string?>(Span<string?> values, object? storeValue, HttpHeaderParser? parser, ref int currentIndex)' due to differences in the nullability of reference types. [/vmr/src/runtime/src/libraries/System.Net.Http/src/System.Net.Http.csproj::TargetFramework=net10.0-linux]
    /vmr/src/runtime/src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/netcore/TensorExtensions.cs(2661,56): error CS0023: Operator '.' cannot be applied to operand of type 'void' [/vmr/src/runtime/src/libraries/System.Numerics.Tensors/src/System.Numerics.Tensors.csproj::TargetFramework=net10.0]
        4 Warning(s)
        1 Error(s)
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Oct 31, 2024
Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-system-numerics-tensors
See info in area-owners.md if you want to be subscribed.

@am11
Copy link
Member Author

am11 commented Oct 31, 2024

unblocks dotnet/sdk#43015 cc @ViktorHofer hopefully this is the only one which triggers "error" 😅

contributes to #108789 (comment) (still has other LINQ usages which aren't relevant to unblock sdk, can be fully addressed separately)

@En3Tho
Copy link
Contributor

En3Tho commented Oct 31, 2024

It seems to me that both operations can be done using one loop?

@ViktorHofer ViktorHofer merged commit 797306f into dotnet:main Oct 31, 2024
80 of 83 checks passed
@am11 am11 deleted the patch-19 branch October 31, 2024 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-System.Numerics.Tensors community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants