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
- Articulation Body with 'Revolute' Joint Type has erratic behavior when Upper Limit is set to above 360
- WebGL Player fails to render Scene when Terrain with Detail Mesh is added and WebGPU Graphics API is used
- Inconsistent errors are logged when different types are passed into the Query "Q<>" method in UIToolkit and the ancestor VisualElement is null
- Crash on GetMaterialPropertyByIndex when opening a specific Scene
- Discrepancies in the styling are present when using a TSS file instead of a USS file in custom EditorWindow
Add comment