Hey,

> > I believe PEVerify should have flagged this as an error.
> That's true... I'm doing this just for the sake of completion :)

Well, my point was, it seems you want to handle overrides "correctly"
for the test sample you gave. But in that case there is no correct
solution since the input is in-correct. :-)

However, I realize that none of us has answered your question, so I'll
give it a try. This is based more on experience with a compiler I'm
writing than with diving into the standards doc, so anyone please
correct me as needed.

A virtual method can override or implement a parent class/iface method
implicitly if its signature matches with the following:
1. same exact name
2. same number of generic method parameters
3. same number of parameters
4. identical types for all parameters by position

Also, two methods can't -- or shouldn't -- coexist in the same class
if they match with the same criteria.
Note 1: (out T) and (ref T) are the same type; They differ in that the
first has the OutAttribute bit set. (I don't know if out can override
ref or vice-versa. The standard doesn't seem to disallow either case.)
Note 2: specialnames op_Implicit and op_Explicit use the return type
as part of their signatures, too.

#4 is the tricky one to implement, since if the methods you're
comparing are in different modules, their TypeReferences to the same
types will be different objects. But I THINK if you take the type
reference from one method and Import() it into the other's module, you
may get the same TypeReference.

Jb, is that the case? Does a module cache its imported references and
return the same object when two imported references refer to the same
type? Is this true even for the various TypeSpecifications?

Or to ask a better question: What's the best way to check if two
TypeReferences refer to the same type? Thanks.
--~--~---------~--~----~------------~-------~--~----~
--
mono-cecil
-~----------~----~----~----~------~----~------~--~---

Reply via email to