dart-lang / dart-lang/language
Context type intentionally different from parameter type in non-standard `==`?
Nobody has claimed this yet.
- Dominant language
- TeX
- Stars
- 2.9k
- Forks
- 239
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 14
Description
Consider the following program:
```dart
X getContextType() {
print(X);
throw 0;
}
class A {
bool operator ==(covariant A other) => identical(this, other);
}
void main() {
A() == getContextType(); // Prints 'dynamic'.
}
```
I would expect the context type to be `A?`.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the provided Dart program and confirming the reported dynamic context type for getContextType(). Then read the language specification and existing discussions around operator ==, covariant parameters, and context types; done means reaching and documenting a settled decision about whether the context should be A?.
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
- 25/100