dart-lang / dart-lang/language

Least upper bound can produce malbounded types.

Open
#651 2 comments 0 reactions 0 assignees View on GitHub
bug technical-debt
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.