[linker] Fix comparison of methods wrt generic parameters [#30488]
The check from [1] is fine when it's done once _or_ with an identical
target. However there's nothing to ensure (if done more than once) that
it's being used to represent the same thing every time.
That makes the code from [1] match methods like:
> System.IObservable`1<TResult> System.Reactive.Linq.IQueryLanguage::Repeat(TResult)
and
> System.IObservable`1<TSource> System.Reactive.Linq.QueryLanguage::Repeat(System.IObservable`1<TSource>)
where `TResult` is different in both checks.
This patch tracks what is used as the generic parameter (on first check)
and make sure it's identical if it's used again in the same signature.
Note: this is a very old bug (i.e. it's always been that way) but recent
changes to mono started to report such issues (a good thing) and, for AOT
compilation on XI, that resulted in MT3001 errors.
[1] https://github.com/mono/mono/blob/mono-3.10.0/mcs/tools/linker/Mono.Linker.Steps/TypeMapStep.cs#L250