dart-lang / dart-lang/language
Least upper bound bug? Analyzer and CFE infer "Function"
- Dominant language
- TeX
- Stars
- 2.9k
- Forks
- 239
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 14
Description
Try this in DartPad:
```dart
Future a(String f) async {}
void b([String f]) {}
void foo(T a, T b) {
print(T);
}
void main() {
foo(a, b);
}
```
I would expect the LUB of `(String) -> Future` and `([String]) -> void` to be `(String) -> void`. Manually providing the type argument `` to `foo` doesn't cause any errors at runtime.
Is this an implementation error or a language issue?
cc @eernstg
Contributor guide
Research direction
Run the DartPad reproduction and inspect the type inferred for foo's generic argument by the analyzer and CFE. Compare that result with the language specification's least-upper-bound rules for the two function types; done means determining whether the behavior is an implementation bug or a language issue and recording the expected result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100