dart-lang / dart-lang/source_gen
isAssignableFromType throws null check error for Function types
- Dominant language
- Dart
- Stars
- 494
- Forks
- 115
- Avg merge
- 12h 13m
- Merged PRs (30d)
- 3
Description
The implementation null asserts `DartType.element2`:
https://github.com/dart-lang/source_gen/blob/0d4c54d2a299643ba2a783ef2e9fcf878305a62d/source_gen/lib/src/type_checker.dart#L170-L171
Which is always null for Function types:
https://github.com/dart-lang/sdk/blob/d6ff1193c5eb1d4b98e232f545cce49c63492b5c/pkg/analyzer/lib/src/dart/element/type.dart#L95-L96
Contributor guide
Research direction
Start in source_gen/lib/src/type_checker.dart at the null assertion in isAssignableFromType, then compare the referenced analyzer DartType implementation for Function types. Reproduce the failure with a Function type and confirm the completed change no longer throws a null-check error while preserving assignability behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100