Search Issue Tracker
By Design
Votes
0
Found in
5.6.0b8
Issue ID
882975
Regression
Yes
Extension method fails to implicitly convert to correct type
Extension method fails to implicitly convert to correct type
To reproduce:
1. Open attached project. Notice the compile error: "Assets/Test.cs(11,14): error CS1929: Type `Floatus' does not contain a member `Testis' and the best extension method overload `Extensions.Testis(this float)' requires an instance of type `float'"
The project has a float with an extension method. It also has a class "Floatus" which has the implicit conversion operator to float. However, calling the extension method on an instance of "Floatus" fails to convert to float correctly
This is a regression - works fine in 5.4.2f2, but fails in 5.5.0f3, 5.6 and up.
The fact that this worked prior to 5.5 was a bug. The same code does not compile in Visual Studio 2015 as well. In general, it is not valid C# code when an implicit conversion is needed to call an extensions method. So the fact that this is an error in 5.5 is a regression, but it is proper behavior.
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- UI Toolkit 'background-size' property is not fully animatable
- Moving the Scrollbar via clicking no longer works after the first-click when page size is too small
- Elements in UI Builder Viewport are displayed incorrectly when Editor UI Scaling is set to 125%
- Prefab referencing a script is not shown in the Search window's Project tab when using "Find References In Project"
- Scroll view sensitivity remains unchanged when modifying the "--unity-metrics-single_line-height" value
Add comment