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
- Crash on RaiseException when terrain detail instancing is excessive
- Prefab variant reference is lost when assigned by click-and-drag in Prefab Editor mode
- Opening any dropdown in Shader Graph stops the Nodes preview but it still plays in the background
- GPU utilization increases when a GameObject is selected
- Motion Blur has sharp edges when object is moving in the foreground of another object
Add comment