

Generic parameters are actually optional and the type is automatically inferred by the type of the variable that is passed.

Stefan Glienke came up with the correct hint: I initially suspected “TValue” of “blocking” the overload resolution here, since TValue is actually an “artificial” RTTI.driven type. function DoSomething(SomeObject: TValue): string should be called, since after all no type parameter is specified and therefore the first variant matches best.īut in fact, the generic, second variant is called. Which of the two possible variants of DoSomething should be called by Foo.DoSomething(Bar)?Īt a first glance, I was inclined to say that the non-generic variant, i.e. Function DoSomething(SomeObject: TValue): string overload įunction DoSomething(SomeObject: T): string overload
