In the latest stable release, the .NET compiler reports problems with an ambiguous call to a method. The previous releases worked fine with this code. Here is a test case for .net console app :
namespace ConsoleApplication8; interface type TLayer = class end ; TLayerClass = class of TLayer; Program = class public class method Main(args: array of String): Int32; end; TMyLayer = class( TLayer ) end ; TReg = class class method Register ; end; method RegisterLayer( const _lc : TLayerClass ) ; overload ; method RegisterLayer( const _lc : &Type ) ; overload ; implementation class method Program.Main(args: array of String): Int32; begin RegisterLayer( TLayer ) ; RegisterLayer( typeOf(TLayer) ) ; TReg.Register; end; class method TReg.Register; begin RegisterLayer( TMyLayer ) ; end; method RegisterLayer( const _lc : TLayerClass ) ; begin // end; method RegisterLayer( const _lc : &Type ) ; begin // end; end.
Here I get
E: Ambiguous call to overloaded method "RegisterLayer". The problem seems to be declarations
"class of TLayer" combined with
&Type overload. New build either treats these declarations as the same types or the method call fails to recognize a proper option.
How the class of type is generated now?
Is this a bug or a permanent change in the compiler? The Java seems to be affected too.