Commit a959971
Fix CS0266 in GetUnitInfo<TQuantity,TUnit> typed overload
The Azure Pipelines build of #1657 (master) fails with:
error CS0266: Cannot implicitly convert type 'UnitInfo<TUnit>' to
'UnitInfo<TQuantity, TUnit>'
at:
return quantity.QuantityInfo[quantity.Unit];
The receiver is statically IQuantity<TQuantity, TUnit>, whose
QuantityInfo getter is shadowed (`new`) to return the more specific
QuantityInfo<TQuantity, TUnit>. Roslyn's member lookup on hosted
images resolves the inherited IQuantity<TUnit>.QuantityInfo
(QuantityInfo<TUnit>) instead, so the indexer returns UnitInfo<TUnit>
and the conversion to UnitInfo<TQuantity, TUnit> fails.
The runtime value is always the more derived type, so cast through
QuantityInfo<TQuantity, TUnit> explicitly to surface the typed
indexer. No behavior change.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 700617d commit a959971
1 file changed
Lines changed: 4 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
48 | 51 | | |
49 | 52 | | |
50 | 53 | | |
| |||
0 commit comments