-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ConstantReader.revive creates a broken reference for Curves.ease #533
Comments
I think I run into this problem or something related when trying to mock a database generated with https://github.com/simolus3/moor There is a The When the mock for the database is generated it contains this fragment for a method where the const factory is used as default value for a parameter: import 'package:moor/src/runtime/api/runtime_api.dart' as _i29;
import 'package:moor/src/runtime/executor/stream_queries.dart' as _i32;
@override
_i35.Stream<Set<_i29.TableUpdate>> tableUpdates(
[_i29.TableUpdateQuery? query = const _i32.TableUpdateQuery.any()]) =>
(super.noSuchMethod(Invocation.method(#tableUpdates, [query]),
returnValue: Stream<Set<_i29.TableUpdate>>.empty())
as _i35.Stream<Set<_i29.TableUpdate>>); The @simolus3 FYI |
Actually meant to post this in the linked mockito issue :/ |
Yes I just confirmed with a unit test that the correct text is revived, with this issue fixed. Thanks! (This is with a minimal repro which aimed to emulate the Curves bug. I don't have a repro set up which uses Curves.) |
…_gen#546) Fixes dart-lang/source_gen#533 Previously when searching for a static field matching a constant object we would use the class name from the type of the object always instead of the class name in which we found the field. This worked in many cases because constant static fields intended for use in other libraries are more often defined on the same class as their type.
…_gen#546) Fixes dart-lang/source_gen#533 Previously when searching for a static field matching a constant object we would use the class name from the type of the object always instead of the class name in which we found the field. This worked in many cases because constant static fields intended for use in other libraries are more often defined on the same class as their type.
(User reported this at dart-lang/mockito#425; mockito's code generation uses source_gen to revive parameter default values)
When trying to revive the default value of the
curve
parameter of TabController.animateTo,ConstantReader.revive
gives backCubic.ease
, which is not a real thing.The default value of this parameter is
Curves.ease
, declared as:When I do some print-debugging, I see that
reviveInstance
gets all the way down to checking fields, whereclazz
isCubic
ande
isCurves.ease
. So the result isRevivable._(source: ..., accessor: 'Cubic.ease')
(again, not a real thing).I think the fix might be as easy as adjusting the for-loop here to hold on to
t
, the type thate
is found on, and using that rather thanclazz
.As a stand-alone example, I have this:
The text was updated successfully, but these errors were encountered: