Skip to content

Commit ea84c1c

Browse files
authored
Merge pull request #58 from Ted-Jin-Lab/development
🐛Fix the operators doesn't work.
2 parents cb2caed + cb648a6 commit ea84c1c

3 files changed

Lines changed: 9 additions & 4 deletions

File tree

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project>
33
<PropertyGroup>
4-
<Version>2025.11.19.4</Version>
4+
<Version>2025.11.19.5</Version>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77
<LangVersion>preview</LangVersion>

Tests/TedToolkit.Console/Absorptance.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,10 @@
33
[QuantityOperator<AbsorbedDose, AbsorbedDose, double>(Operator.Divide)]
44
partial struct AbsorbedDose
55
{
6-
6+
public static void Test()
7+
{
8+
var a = new AbsorbedDose(10, AbsorbedDoseUnit.Centigray);
9+
var b = new AbsorbedDose(10, AbsorbedDoseUnit.Centigray);
10+
var c = a / b;
11+
}
712
}

src/analyzers/TedToolkit.Quantities.Analyzer/QuantityStructGenerator.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ public void GenerateCode(SourceProductionContext context)
4545
foreach (var attributeData in quantitySymbol.GetAttributes()
4646
.Where(a => a.AttributeClass is { IsGenericType: true } attributeClass
4747
&& attributeClass.ConstructUnboundGenericType().GetName().FullName is
48-
"global::TedToolkit.Quantities.QuantityOperatorAttribute<,>"))
48+
"global::TedToolkit.Quantities.QuantityOperatorAttribute<,,>"))
4949
{
5050
if (attributeData.ConstructorArguments.FirstOrDefault().Value is not byte value) continue;
5151

52-
if (attributeData.AttributeClass is not { TypeArguments.Length: > 1 } attributeClass) continue;
52+
if (attributeData.AttributeClass is not { TypeArguments.Length: > 2 } attributeClass) continue;
5353

5454
var leftType = attributeClass.TypeArguments[0].GetName();
5555
var rightType = attributeClass.TypeArguments[1].GetName();

0 commit comments

Comments
 (0)