effekt-lang / effekt-lang/effekt
Attempting to invoke a method on an unboxed object yields confusing error message
- Dominant language
- Scala
- Stars
- 469
- Forks
- 41
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 23
Description
Consider the following program:
```
interface Stream[A] {
def head(): A
def tail(): Stream[A] at {}
}
def main() = {
def ones = new Stream[Int] {
def head() = 1
def tail() = ones
}
val rest: Stream[Int] at {} = ones.tail()
println(rest.head())
}
```
It marks the invocation `rest.head()` and gives me the following error:
```
Cannot typecheck call.
There are multiple overloads, which all fail to check:
Possible overload: effekt::println of type String => Unit
Cannot find type for head -- forward uses and recursive functions need annotated return types.
...
```
Ideally, this program would just be accepted and the implicit `unbox` inserted around `rest`. Even better, `ones.tail().tail().head()` should be accepted as well.
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the supplied Stream program and compare the failures for rest.head() and ones.tail().tail().head(). The issue names no files or tests, so trace the compiler's typechecking of method calls on unboxed objects; done means both forms are accepted with the implicit unbox inserted and the confusing overload error is gone.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- scala
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100