Skip to content

Commit a90f7ab

Browse files
Expose the extension operators for Tensor, TensorSpan, and ROTensorSpan (#117997)
* Ensure the DynamicallyAccessedMembersAnalyzer doesn't crash for new language features * Adding the extensions for operator + and operator += * Adding the extensions for operator / and operator /= * Adding the extensions for operator * and operator *= * Adding the extensions for operator - and operator -= * Adding the extensions for operator & and operator &= * Adding the extensions for operator | and operator |= * Adding the extensions for operator ^ and operator ^= * Adding the extensions for operator ~ * Adding the extensions for operator - (unary) * Adding the extensions for operator + (unary) * Adding the extensions for operator << and operator <<= * Adding the extensions for operator >> and operator >>= * Adding the extensions for operator >>> and operator >>>= * Adding the extensions for operator ++ * Adding the extensions for operator -- * Ensure the extension member order in the ref matches the impl * Update CompatibilitySuppressions for a fixed parameter name in an experimental API * Change TrimAnalysisVisitor.VisitParameterReference to skip parameters that are not on methods so the analyzer doesn't throw * Apply suggestions from code review Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Copilot <[email protected]>
1 parent 2fa82a2 commit a90f7ab

24 files changed

+2016
-549
lines changed

src/libraries/System.Numerics.Tensors/ref/System.Numerics.Tensors.netcore.cs

Lines changed: 322 additions & 0 deletions
Large diffs are not rendered by default.

src/libraries/System.Numerics.Tensors/src/CompatibilitySuppressions.xml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -841,6 +841,13 @@
841841
<Right>lib/net8.0/System.Numerics.Tensors.dll</Right>
842842
<IsBaselineSuppression>true</IsBaselineSuppression>
843843
</Suppression>
844+
<Suppression>
845+
<DiagnosticId>CP0017</DiagnosticId>
846+
<Target>M:System.Numerics.Tensors.Tensor.OnesComplement``1(System.Numerics.Tensors.ReadOnlyTensorSpan{``0}@,System.Numerics.Tensors.TensorSpan{``0}@)$0</Target>
847+
<Left>lib/net8.0/System.Numerics.Tensors.dll</Left>
848+
<Right>lib/net8.0/System.Numerics.Tensors.dll</Right>
849+
<IsBaselineSuppression>true</IsBaselineSuppression>
850+
</Suppression>
844851
<Suppression>
845852
<DiagnosticId>CP0017</DiagnosticId>
846853
<Target>M:System.Numerics.Tensors.Tensor`1.AsReadOnlyTensorSpan(System.ReadOnlySpan{System.Buffers.NIndex})$0</Target>
@@ -1016,6 +1023,13 @@
10161023
<Right>lib/net9.0/System.Numerics.Tensors.dll</Right>
10171024
<IsBaselineSuppression>true</IsBaselineSuppression>
10181025
</Suppression>
1026+
<Suppression>
1027+
<DiagnosticId>CP0017</DiagnosticId>
1028+
<Target>M:System.Numerics.Tensors.Tensor.OnesComplement``1(System.Numerics.Tensors.ReadOnlyTensorSpan{``0}@,System.Numerics.Tensors.TensorSpan{``0}@)$0</Target>
1029+
<Left>lib/net9.0/System.Numerics.Tensors.dll</Left>
1030+
<Right>lib/net9.0/System.Numerics.Tensors.dll</Right>
1031+
<IsBaselineSuppression>true</IsBaselineSuppression>
1032+
</Suppression>
10191033
<Suppression>
10201034
<DiagnosticId>CP0017</DiagnosticId>
10211035
<Target>M:System.Numerics.Tensors.Tensor`1.AsReadOnlyTensorSpan(System.ReadOnlySpan{System.Buffers.NIndex})$0</Target>
@@ -1107,6 +1121,24 @@
11071121
<Right>lib/net9.0/System.Numerics.Tensors.dll</Right>
11081122
<IsBaselineSuppression>true</IsBaselineSuppression>
11091123
</Suppression>
1124+
<Suppression>
1125+
<DiagnosticId>CP0017</DiagnosticId>
1126+
<Target>M:System.Numerics.Tensors.Tensor.OnesComplement``1(System.Numerics.Tensors.ReadOnlyTensorSpan{``0}@,System.Numerics.Tensors.TensorSpan{``0}@)$0</Target>
1127+
<Left>ref/net10.0/System.Numerics.Tensors.dll</Left>
1128+
<Right>lib/net10.0/System.Numerics.Tensors.dll</Right>
1129+
</Suppression>
1130+
<Suppression>
1131+
<DiagnosticId>CP0017</DiagnosticId>
1132+
<Target>M:System.Numerics.Tensors.Tensor.OnesComplement``1(System.Numerics.Tensors.ReadOnlyTensorSpan{``0}@,System.Numerics.Tensors.TensorSpan{``0}@)$0</Target>
1133+
<Left>ref/net8.0/System.Numerics.Tensors.dll</Left>
1134+
<Right>lib/net8.0/System.Numerics.Tensors.dll</Right>
1135+
</Suppression>
1136+
<Suppression>
1137+
<DiagnosticId>CP0017</DiagnosticId>
1138+
<Target>M:System.Numerics.Tensors.Tensor.OnesComplement``1(System.Numerics.Tensors.ReadOnlyTensorSpan{``0}@,System.Numerics.Tensors.TensorSpan{``0}@)$0</Target>
1139+
<Left>ref/net9.0/System.Numerics.Tensors.dll</Left>
1140+
<Right>lib/net9.0/System.Numerics.Tensors.dll</Right>
1141+
</Suppression>
11101142
<Suppression>
11111143
<DiagnosticId>CP0021</DiagnosticId>
11121144
<Target>M:System.Numerics.Tensors.Tensor.Average``1(System.Numerics.Tensors.ReadOnlyTensorSpan{``0}@)``0:T:System.Numerics.INumberBase{``0}</Target>

src/libraries/System.Numerics.Tensors/src/System.Numerics.Tensors.csproj

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,21 @@
3939
<Compile Include="System\Numerics\Tensors\netcore\ReadOnlyTensorDimensionSpan_1.cs" />
4040
<Compile Include="System\Numerics\Tensors\netcore\ReadOnlyTensorSpan_1.cs" />
4141
<Compile Include="System\Numerics\Tensors\netcore\Tensor.cs" />
42+
<Compile Include="System\Numerics\Tensors\netcore\Tensor.op_Addition.cs" />
43+
<Compile Include="System\Numerics\Tensors\netcore\Tensor.op_BitwiseAnd.cs" />
44+
<Compile Include="System\Numerics\Tensors\netcore\Tensor.op_BitwiseOr.cs" />
45+
<Compile Include="System\Numerics\Tensors\netcore\Tensor.op_Decrement.cs" />
46+
<Compile Include="System\Numerics\Tensors\netcore\Tensor.op_Division.cs" />
47+
<Compile Include="System\Numerics\Tensors\netcore\Tensor.op_ExclusiveOr.cs" />
48+
<Compile Include="System\Numerics\Tensors\netcore\Tensor.op_Increment.cs" />
49+
<Compile Include="System\Numerics\Tensors\netcore\Tensor.op_LeftShift.cs" />
50+
<Compile Include="System\Numerics\Tensors\netcore\Tensor.op_Multiply.cs" />
51+
<Compile Include="System\Numerics\Tensors\netcore\Tensor.op_OnesComplement.cs" />
52+
<Compile Include="System\Numerics\Tensors\netcore\Tensor.op_RightShift.cs" />
53+
<Compile Include="System\Numerics\Tensors\netcore\Tensor.op_Subtraction.cs" />
54+
<Compile Include="System\Numerics\Tensors\netcore\Tensor.op_UnaryNegation.cs" />
55+
<Compile Include="System\Numerics\Tensors\netcore\Tensor.op_UnaryPlus.cs" />
56+
<Compile Include="System\Numerics\Tensors\netcore\Tensor.op_UnsignedRightShift.cs" />
4257
<Compile Include="System\Numerics\Tensors\netcore\Tensor_1.cs" />
4358
<Compile Include="System\Numerics\Tensors\netcore\TensorDimensionSpan_1.cs" />
4459
<Compile Include="System\Numerics\Tensors\netcore\TensorOperation.cs" />
@@ -149,6 +164,8 @@
149164
<Compile Include="System\Numerics\Tensors\netcore\TensorPrimitives.Round.cs" />
150165
<Compile Include="System\Numerics\Tensors\netcore\TensorPrimitives.ScaleB.cs" />
151166
<Compile Include="System\Numerics\Tensors\netcore\TensorPrimitives.ShiftLeft.cs" />
167+
<Compile Include="System\Numerics\Tensors\netcore\TensorPrimitives.ShiftRightArithmetic.cs" />
168+
<Compile Include="System\Numerics\Tensors\netcore\TensorPrimitives.ShiftRightLogical.cs" />
152169
<Compile Include="System\Numerics\Tensors\netcore\TensorPrimitives.Sigmoid.cs" />
153170
<Compile Include="System\Numerics\Tensors\netcore\TensorPrimitives.Sign.cs" />
154171
<Compile Include="System\Numerics\Tensors\netcore\TensorPrimitives.Sin.cs" />

0 commit comments

Comments
 (0)