From f081a4a515f2520a79f1d91b7e8ef26b8ad08cbe Mon Sep 17 00:00:00 2001 From: Tobe O Date: Fri, 22 Nov 2019 08:20:00 -0500 Subject: [PATCH] Fix HookedService type error --- CHANGELOG.md | 4 ++++ lib/src/core/hooked_service.dart | 8 ++++---- test/all.dart | 4 ++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fd729a5c..b30851f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 2.0.5 +* Fix a new (did not appear before 2.6/2.7) type error causing compilation to fail. +https://github.com/angel-dart/framework/issues/249 + # 2.0.5-beta * Make `@Expose()` in `Controller` optional. https://github.com/angel-dart/angel/issues/107 * Add `allowHttp1` to `AngelHttp2` constructors. https://github.com/angel-dart/angel/issues/108 diff --git a/lib/src/core/hooked_service.dart b/lib/src/core/hooked_service.dart index 00216f49..91e6b99f 100644 --- a/lib/src/core/hooked_service.dart +++ b/lib/src/core/hooked_service.dart @@ -95,12 +95,12 @@ class HookedService> /// Adds hooks to this instance. void addHooks(Angel app) { - Hooks hooks = getAnnotation(inner, app.container.reflector); + var hooks = getAnnotation(inner, app.container.reflector); List> before = [], after = []; if (hooks != null) { - before.addAll(hooks.before); - after.addAll(hooks.after); + before.addAll(hooks.before.cast()); + after.addAll(hooks.after.cast()); } void applyListeners( @@ -111,7 +111,7 @@ class HookedService> ..addAll(isAfter == true ? after : before); if (hooks != null) { - listeners.addAll(isAfter == true ? hooks.after : hooks.before); + listeners.addAll((isAfter == true ? hooks.after : hooks.before).cast()); } listeners.forEach(dispatcher.listen); diff --git a/test/all.dart b/test/all.dart index e2a94623..5f517bbb 100644 --- a/test/all.dart +++ b/test/all.dart @@ -10,7 +10,7 @@ import 'di_test.dart' as di; import 'encoders_buffer_test.dart' as encoders_buffer; import 'env_test.dart' as env; import 'exception_test.dart' as exception; -import 'extension_test.dart' as extension; +import 'extension_test.dart' as extension_test; import 'find_one_test.dart' as find_one; import 'general_test.dart' as general; import 'hooked_test.dart' as hooked; @@ -42,7 +42,7 @@ main() { group('encoders_buffer', encoders_buffer.main); group('env', env.main); group('exception', exception.main); - group('extension', extension.main); + group('extension', extension_test.main); group('find_one', find_one.main); group('general', general.main); group('hooked', hooked.main);