[nem-en] Compare two MType
vc
vc at rsdn.ru
Fri Nov 24 04:08:01 CET 2006
> > You need to call GetFreshType() on the method, ignore TyVars and match
> > MType returned against MType.Fun. It will have T.123 replaced with a
> > fresh type variable that will be substitued with string.
>
> Or, better yet do a (untested):
>
> match (ty.TypeOfMethod (meth).Fix ()) {
> | Fun (from, _) =>
> match (from.Fix ().GetFunctionArguments ()) {
> | t1 :: _ => ty.TryProvide (t1)
> | _ => false
> }
> | _ => Util.ice ()
> }
>
> which should also work when the defing class of an extension method is
> generic (as oposed to just the method being generic).
This code don't work. It's code work:
protected override IsExtendType (method : IMethod, tyVar : TyVar) : bool
{
match (method.GetFreshType())
{
| (MType.Fun(from, _), _) =>
match (from.Fix().GetFunctionArguments())
{
| paramMType :: _ => paramMType.TryProvide(tyVar);
| _ => false
}
| _ => false
}
}
But, in all cese, thanks.
More information about the devel-en
mailing list