[linker] Fix comparison of methods wrt generic parameters [#30488]
authorSebastien Pouliot <sebastien@xamarin.com>
Wed, 1 Jul 2015 15:37:00 +0000 (11:37 -0400)
committerSebastien Pouliot <sebastien@xamarin.com>
Wed, 1 Jul 2015 15:37:00 +0000 (11:37 -0400)
commit080fc527bd9b5095048b14bc596c5be9929754a4
tree853eb14b782d92045bcb9a9bbce2782d1329c115
parent93bb234cea3676b97559e752dcf82a26915d5f32
[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
mcs/tools/linker/Mono.Linker.Steps/TypeMapStep.cs