Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(841)

Unified Diff: pkg/dev_compiler/lib/src/compiler/nullable_type_inference.dart

Issue 2693593002: keep null check on virtual field (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/dev_compiler/test-main.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/dev_compiler/lib/src/compiler/nullable_type_inference.dart
diff --git a/pkg/dev_compiler/lib/src/compiler/nullable_type_inference.dart b/pkg/dev_compiler/lib/src/compiler/nullable_type_inference.dart
index 09e8649b3ca9a59af41ad540be323c497aa1979d..796811370f0062a4597812705ac9013670f8c09c 100644
--- a/pkg/dev_compiler/lib/src/compiler/nullable_type_inference.dart
+++ b/pkg/dev_compiler/lib/src/compiler/nullable_type_inference.dart
@@ -81,7 +81,8 @@ abstract class NullableTypeInference {
if (element is PropertyAccessorElement && element.isGetter) {
PropertyInducingElement variable = element.variable;
- return variable.computeConstantValue()?.isNull ?? true;
+ var isVirtual = variable is FieldElement && variable.isVirtual;
+ return isVirtual || (variable.computeConstantValue()?.isNull ?? true);
}
// Other types of identifiers are nullable (parameters, fields).
« no previous file with comments | « no previous file | pkg/dev_compiler/test-main.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698