I have to ask why? i is Int64 only, will always be int64 only, so all other comparisons are always skipped.
I could see this, inside a method with an untyped parameter: procedure doSomething(myvar;out success:boolean); Begin {… your if is comparisons …} end; This opens your method to be used for all types for param1. Ozz > On Apr 14, 2018, at 5:51 AM, Thorsten Engler <thorsten.eng...@gmx.net> wrote: > > I haven't checked out the changes you made to the compiler, so you might have > already covered this, but while you are at it, you might want to just make > this work for any ordinal type with a well-defined upper/lower bound (any > type for which High()/Low() can be evaluated at compile time). So: > > type > TSubRange=-5..5; > TEnum=(One, Two); > > var > i: Int64; > > begin > if i is TSubRange then > //... > If i is TEnum then > //... > If i is SmallInt then > //... > > (same with "as"). > > > >> -----Original Message----- >> From: fpc-devel <fpc-devel-boun...@lists.freepascal.org> On Behalf >> Of Ondrej Pokorny >> Sent: Saturday, 14 April 2018 19:03 >> To: fpc-devel@lists.freepascal.org >> Subject: Re: [fpc-devel] Dangerous optimization in CASE..OF >> >> On 14.04.2018 10:39, Thorsten Engler wrote: >>> How about following the same schema as with classes? >>> >>> If 1 is TMyEnum then >>> //use hard cast here >> >> Yes, that is reasonable as well and it will be easier to implement >> than the TryIntToEnum/IntToEnum intrinsics for me. >> >> Ondrej >> _______________________________________________ >> fpc-devel maillist - fpc-devel@lists.freepascal.org >> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel > > _______________________________________________ > fpc-devel maillist - fpc-devel@lists.freepascal.org > http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel _______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel