dart-lang / dart-lang/source_gen
ConstantReader.revive cannot revive constant fields with a type not defined in the same library as the field
- Dominant language
- Dart
- Stars
- 494
- Forks
- 115
- Avg merge
- 12h 13m
- Merged PRs (30d)
- 3
Description
For instance trying to revive from
```dart
@Foo.foo
class Foo {
static const foo = Deprecated('argument');
}
```
When we search for potential fields which define this argument, we only search the library that defines `Deprecated`), and of course never find a field equal to our object.
https://github.com/dart-lang/source_gen/blob/4dc8f1f9f51f9126aa50bad1736249bc3d8a0623/source_gen/lib/src/constants/revive.dart#L68
If we could know to search the library defining `Foo` we'd find it.
Contributor guide
Research direction
Inspect source_gen/lib/src/constants/revive.dart around line 68 and reproduce the example where Deprecated is defined in a different library from Foo. Trace how potential fields are selected; done means ConstantReader.revive finds Foo.foo across library boundaries and revives the constant value.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100