[Vala] Strange comment in valatypeparameter.vala



Hey there,

I'd expect this code to be rejected as t is being overridden by a method with a different return type:

abstract class Foo<T> {
  public abstract T t();
}
class Bar<V, U> : Foo<U> {
  public override V t() {
    return null;
  }
}

I debugged it and traced it back to the following implementation of ValaTypeParameter.vala:

public bool equals (TypeParameter param2) {
  // FIXME check whether the corresponding data type of one of the
  // parameters is a base type of the corresponding data
  // type of the other parameter and check along the path
  // whether one parameter maps to the other
  return true;
}

I don't really understand the comment – what is "the corresponding data type" in this context? If I just 
replace the
implementation by something reasonable, say by comparing the source references, it seems to work fine. I get 
an
error message for the above code and when I change V to U in t's return type, the code compiles. It seems to
me that the check of whether one parameter maps to the other is already done elsewhere… Am I missing 
something here?

Cheers,
Matthias


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]