effekt-lang / effekt-lang/effekt
Confusing error message for different types with same name
- Dominant language
- Scala
- Stars
- 469
- Forks
- 41
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 23
Description
Trying to write a sort that works on the first element of a tuple:
```
import immutable/list
def comparePairsByFirst[A, B](x: Tuple2[A, B], y: Tuple2[A, B]){ compare: (A, A) => Boolean }: Boolean = {
val (a1, b1) = x
val (a2, b2) = y
compare(a1, a2)
}
def sortOnFst[Int, B](lst: List[Tuple2[Int, B]]): List[Tuple2[Int, B]] = {
lst.sortBy { (p1, p2) =>
comparePairsByFirst(p1, p2) {
(a, b) => a < b
}
}
}
```
This is reproducible both on the website and on current `master`.
I got the following error message:
```
Cannot typecheck call.
There are multiple overloads, which all fail to check:
Possible overload: effekt.infixLt of type (Int, Int) => Boolean
Expected Int but got Int.
Expected Int but got Int.
Possible overload: effekt.infixLt$1 of type (Double, Double) => Boolean
Expected Double but got Int.
Expected Double but got Int.
Possible overload: effekt.infixLt$2 of type (String, String) => Boolean
Expected String but got Int.
Expected String but got Int.
```
Specifically, the very first part seems wrong:
```
Possible overload: effekt.infixLt of type (Int, Int) => Boolean
Expected Int but got Int.
Expected Int but got Int.
```
This overload looks like it should work in my case (I'm comparing two `Int`s), but it gets refused for some mysterious reason.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.