dart-lang / dart-lang/language
Least upper bound can produce malbounded types.
- Dominant language
- TeX
- Stars
- 2.9k
- Forks
- 239
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 14
Description
Noting in passing for future consideration. Not a soundness issue, since we already allow generic arguments to violate their bounds in types, but an unpleasantness. Example below demonstrates the issue: upper bound computation produces `A` for the type of `x`, which is not a well-bounded type.
```dart
class A0 {}
class B0 {}
class B1 extends B0 {}
class C extends A0 implements B1 {}
class D extends A0 implements B1 {}
class A {}
foo(int z) {
A ac;
A ad;
var x = z == 3 ? ac : ad;
z = x;
}
```
Contributor guide
Research direction
Issue #651 provides a Dart reproducer for least-upper-bound computation; start by locating the language specification and type-inference tests covering conditional expressions and generic bounds. The report names no files or tests, and done requires an agreed behavior plus specification or regression-test coverage for the malbounded inferred type.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100