Skip to content
This repository was archived by the owner on Sep 16, 2022. It is now read-only.

Commit 69538d0

Browse files
leonsenftalorenzen
authored andcommitted
fix(Compiler): Fix a case where provider fields weren't type annotated
Closes #915. PiperOrigin-RevId: 186834153
1 parent dfe1040 commit 69538d0

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

_tests/test/core/change_detection/detect_host_changes_test.dart

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,5 @@ class SomeDirective {
5757
String dataXyz = 'abc';
5858
bool disabled = true;
5959
void handleClick(Event e) {}
60-
61-
// TODO: Should be 'KeyEvent'.
62-
// See https://github.com/dart-lang/angular/issues/915.
63-
void handleKeyPress(Event e) {}
60+
void handleKeyPress(KeyEvent e) {}
6461
}

angular/CHANGELOG.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,12 @@ class Comp {
220220
D. Giving C local visibility incorrectly prevented this assignment and
221221
generated code to inject D from the parent injector.
222222
223-
* Fixed a bug where `Provider<List<T>>` was treated as `Provider<List>` when
224-
compiled as part of the view compiler (`@Component.providers:`). Now the
225-
additional generic types flow through the compiler.
223+
* Fixed a bug where `Provider<List<T>>` was treated as `Provider<List>` when
224+
compiled as part of the view compiler (`@Component.providers:`). Now the
225+
additional generic types flow through the compiler.
226+
227+
* Fixed a case where provider fields weren't type annotated. In some cases
228+
this led to DDC warnings that are to become errors.
226229
227230
## 5.0.0-alpha+5
228231

angular/lib/src/compiler/view_compiler/compile_view.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -871,14 +871,14 @@ class CompileView implements AppViewBuilder {
871871
)
872872
: o.DYNAMIC_TYPE);
873873
} else {
874-
resolvedProviderValueExpr = providerValueExpressions[0];
874+
resolvedProviderValueExpr = providerValueExpressions.first;
875875
if (provider.typeArgument != null) {
876876
type = o.importType(
877877
provider.typeArgument,
878878
provider.typeArgument.genericTypes,
879879
);
880880
} else {
881-
type = providerValueExpressions[0].type;
881+
type = resolvedProviderValueExpr.type;
882882
}
883883
}
884884

@@ -986,7 +986,7 @@ class CompileView implements AppViewBuilder {
986986
? o.DYNAMIC_TYPE
987987
: (providerHasChangeDetector ? changeDetectorType : type)));
988988
}
989-
return new o.ReadClassMemberExpr(propName);
989+
return new o.ReadClassMemberExpr(propName, type);
990990
}
991991

992992
@override

0 commit comments

Comments
 (0)