Provide an invalid type for failed type inference
- Dominant language
- Dart
- Stars
- 13
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
Consider the following program:
```
let myInt = _12_3
let myIntReturningFunction _ = myInt
```
Trying to compile it results in the following:
```
[0:13] Error at '_12_3': The symbol '_12_3' was not found in the scope.
0: let myInt = _12_3
^^^^^
1:
[2:32] Error at 'myInt': The symbol 'myInt' was not found in the scope.
1:
2: let myIntReturningFunction _ = myInt
^^^^^
```
The first error is perfectly fine, as `_12_3` has not been defined in the context.
However, the second error is misleading. `myInt` was not properly defined because type inference failed, but it exists.
Dart deals with it by having a `InvalidType`. This way, we could infer the type of `myInt` to `InvalidType` and treat each case where expect a valid type as an error instead, giving a more proper message.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by compiling the reproducer in the issue and tracing the type-inference and diagnostic paths that handle the unresolved _12_3 and subsequent myInt reference. Determine how an invalid inferred type should propagate through later checks. Done means the original unresolved-symbol error remains, while the follow-up error no longer claims that myInt is absent and invalid-type uses produce appropriate diagnostics.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100