Skip to content
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

Duplicate typedef are ignored #778

Open
dickermoshe opened this issue Oct 29, 2024 · 0 comments · May be fixed by #776
Open

Duplicate typedef are ignored #778

dickermoshe opened this issue Oct 29, 2024 · 0 comments · May be fixed by #776

Comments

@dickermoshe
Copy link

Identical typedefs are ignored.
So BarDef2 is not added to the element list because it has the same type as BarDef even though it.

We should not add identical types, but aliases should be added even if their types are the same.

import 'package:mockito/annotations.dart';
class Bar {}
typedef BarDef = int Function();
typedef BarDef2 = int Function();
class BaseFoo<T,P> {
  BaseFoo(this.t1, this.t2);
  final T t1;
  final P t2;
}
class Foo extends BaseFoo<BarDef, BarDef2> {
  Foo() : super(() => 1, () => 2);
}
@GenerateMocks([Foo])
void main() {}
  'package:mockito/src/builder.dart': Failed assertion: line 2201 pos 12: 'mockLibraryInfo.assetUris.containsKey(element)': An element, "typedef BarDef2 = int Function()", is missing from the asset URI mapping
  dart:core                                                    _AssertionError._throwNew
  package:mockito/src/builder.dart 2201:12                     _MockClassInfo._typeImport
  package:mockito/src/builder.dart 2167:19                     _MockClassInfo._typeReference.<fn>
  package:code_builder/src/specs/type_reference.g.dart 164:33  _$TypeReferenceBuilder.update
  package:code_builder/src/specs/type_reference.g.dart 22:36   new _$TypeReference
  package:mockito/src/builder.dart 2164:14                     _MockClassInfo._typeReference
  package:mockito/src/builder.dart 1923:25                     _MockClassInfo._buildOverridingGetter
  package:mockito/src/builder.dart 1232:36                     _MockClassInfo.fieldOverrides.<fn>
  package:code_builder/src/specs/method.g.dart 323:33          _$MethodBuilder.update
  package:code_builder/src/specs/method.g.dart 38:29           new _$Method
  package:mockito/src/builder.dart 1232:15                     _MockClassInfo.fieldOverrides
  dart:core                                                    List.addAll
  package:built_collection/src/list/list_builder.dart 98:14    ListBuilder.addAll
  package:mockito/src/builder.dart 1190:28                     _MockClassInfo._buildMockClass.<fn>.<fn>
  package:mockito/src/builder.dart 2083:24                     _MockClassInfo._withTypeParameters
  package:mockito/src/builder.dart 1144:7                      _MockClassInfo._buildMockClass.<fn>
  package:code_builder/src/specs/class.g.dart 345:33           _$ClassBuilder.update
  package:code_builder/src/specs/class.g.dart 40:28            new _$Class
  package:mockito/src/builder.dart 1122:12                     _MockClassInfo._buildMockClass
  package:mockito/src/builder.dart 1068:9                      new _MockLibraryInfo
  package:mockito/src/builder.dart 94:29                       MockBuilder.build
  ===== asynchronous gap ===========================
  package:build/src/generate/run_builder.dart 83:7             runBuilder.buildForInput
  ===== asynchronous gap ===========================
  package:build/src/builder/logging.dart 32:40                 scopeLogAsync.<fn>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant