You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The generated code imports everything as _inumber, but it forgets to add the prefix for the Type decratation of the implemented file.
So for an annotation like this: @GenerateMocks([], customMocks: [MockSpec<Foo<Bar>>()])
the generated Class declaration looks like this: class MockFoo extends _i1.Mock implements _i2.Foo<Bar>
and i get The name 'Bar' isn't a type so it can't be used as a type argument.
it should generate : @GenerateMocks([], customMocks: [MockSpec<Foo<_i3.Bar>>()])
since it imports Bar as _i3
i'm on mockito: ^5.0.3
The text was updated successfully, but these errors were encountered:
srawlins
added
P2
A bug or feature request we're likely to work on
type-bug
Incorrect behavior (everything from a crash to more subtle misbehavior)
labels
Apr 12, 2021
Fixes#382
All imports in mockito's generated code use import prefixes, and so a prefix always needs to be attached to a reference to a library element (like a class).
Forgetting a URL has been the source of multiple bugs, so this change includes a broader refactor as well to hide code_builder's `refer` function, and instead provide our own.
PiperOrigin-RevId: 368050695
The generated code imports everything
as _inumber
, but it forgets to add the prefix for the Type decratation of the implemented file.So for an annotation like this:
@GenerateMocks([], customMocks: [MockSpec<Foo<Bar>>()])
the generated Class declaration looks like this:
class MockFoo extends _i1.Mock implements _i2.Foo<Bar>
and i get
The name 'Bar' isn't a type so it can't be used as a type argument.
it should generate :
@GenerateMocks([], customMocks: [MockSpec<Foo<_i3.Bar>>()])
since it imports Bar
as _i3
i'm on
mockito: ^5.0.3
The text was updated successfully, but these errors were encountered: