Iterator interface applied to generators has wrong type for current()
Open
hack
- Dominant language
- C++
- Stars
- 18.7k
- Forks
- 3.1k
- Avg merge
- 1h 47m
- Merged PRs (30d)
- 2
Description
``` hack
function blarr(): Iterator {
yield break;
}
function main(): void {
$b = blarr();
$b->next();
$cur = $b->current();
// hh thinks $cur is int, but it's null
}
```
I'm not sure what the right solution is: making `Iterator::current()` return `?Tv` seems unfortunate when this isn't the case for most iterators.
Contributor guide
Assessment
This issue has not been assessed yet.