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
- Audio Mixer does not change volume when lowering volume on an Audio Mixer loaded from AssetBundles
- Error “Value cannot be null. Parameter name: key UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)” thrown and Addressables build fails when "Include in Build" is disabled and using Addressables For Android package
- “error CS0433: The type 'CodeBinaryOperatorType' exists in both 'System.CodeDom and 'System" compilation errors are thrown when opening a specific project
- Metal Vertex Shader warning is being thrown when creating a VR Template Project
- Asset database warning is thrown when declaring font variable in the USS text file
Add comment