Shadowing the type parameter in non-static nested classes
- Dominant language
- Dart
- Stars
- 275
- Forks
- 144
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 55
Description
Say we have a nested class like:
```java
public class A {
public class B {
// ...
}
}
```
As far as I know, we cannot use the type parameter `T (outer)` inside `B` because `T (inner)` shadows it. So we can safely ignore the outer `T`.
- [ ] TODO: verify the above.
However we generate the code for this wrong in the unnesting process:
```dart
class B<$T extends JObject, $T extends JObject> { /* ... */ }
```
We should only generate one of the type parameters, but also correctly differentiate between the two when inferring types.
Contributor guide
Research direction
Start by tracing the unnesting process and the type-inference logic for nested generic classes. Verify the Java shadowing behavior in the issue's A/B example, then confirm that generated B declares only the applicable type parameter while inference distinguishes outer and inner parameters.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100