Skip to content

Commit 1dafb54

Browse files
dickermoshesrawlins
authored andcommitted
parse the contents of a typedef
1 parent f1bd468 commit 1dafb54

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

lib/src/builder.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,7 @@ class _TypeVisitor extends RecursiveElementVisitor<void> {
317317

318318
@override
319319
void visitTypeAliasElement(TypeAliasElement element) {
320+
_addType(element.aliasedType);
320321
_elements.add(element);
321322
super.visitTypeAliasElement(element);
322323
}

test/builder/auto_mocks_test.dart

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3583,18 +3583,21 @@ void main() {
35833583
expect(mocksContent, contains('implements _i2.Baz'));
35843584
});
35853585

3586-
test('when a type parameter is a typedef a function', () async {
3586+
test(
3587+
'when a type parameter is a typedef a function which returns another type',
3588+
() async {
35873589
final mocksContent = await buildWithNonNullable({
35883590
...annotationsAsset,
35893591
'foo|lib/foo.dart': dedent(r'''
3590-
typedef CreateInt = int Function();
3592+
class Bar {}
3593+
typedef CreateBar = Bar Function();
35913594
35923595
class BaseFoo<T> {
35933596
BaseFoo(this.t);
35943597
final T t;
35953598
}
35963599
3597-
class Foo extends BaseFoo<CreateInt> {
3600+
class Foo extends BaseFoo<CreateBar> {
35983601
Foo() : super(() => 1);
35993602
}
36003603
'''),

0 commit comments

Comments
 (0)