rascal
rascal copied to clipboard
Overloads with different type parameter names cause error
Describe the bug
The typechecker throws an error on overloaded function definitions where the type parameters have different names in the various overloads.
To Reproduce
list[&U] repeatn(&U elt, int n) = [elt, *repeatn(elt, n - 1)] when n > 0;
// Return type `list[&U]` of function `repeatn` is not comparable with return type `list[&T]` of other declaration with comparable arguments
default list[&T] repeatn(&T elt, _) = [];
// Return type `list[&T]` of function `repeatn` is not comparable with return type `list[&U]` of other declaration with comparable arguments
Expected behavior No errors.