rascal icon indicating copy to clipboard operation
rascal copied to clipboard

Overloads with different type parameter names cause error

Open toinehartman opened this issue 1 year ago • 0 comments

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.

toinehartman avatar Jul 30 '24 07:07 toinehartman