I can reproduce this with the following minimal example
Program1.dpr
program Project1; {$APPTYPE CONSOLE} uses System.SysUtils, Unit1 in 'Unit1.pas'; begin Writeln(abc.ToString); end.
Unit1.pas
unit Unit1; interface const abc = 127; implementation end.
This is a clear compiler error. You can work around the issue with a hint of an inelegant type as follows:
const abc = Shortint(127);
This tells me that when there is no type hint, the compiler sees 127
as something other than Shortint
. I'm not quite sure that, though, because I do not see the inside of the compiler.
Submit a bug report to Embarcadero.
source share