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

Unified Diff: pkg/analyzer/lib/src/generated/error_verifier.dart

Issue 1827243003: Allow values to be returned from implicitly typed setters (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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/analyzer/test/generated/strong_mode_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/generated/error_verifier.dart
diff --git a/pkg/analyzer/lib/src/generated/error_verifier.dart b/pkg/analyzer/lib/src/generated/error_verifier.dart
index 4a3e4fdf2307b30a436be998072b8438e4bf7ef1..7824d87777cdfdea2e5b3b5f073fe73a326ec7c9 100644
--- a/pkg/analyzer/lib/src/generated/error_verifier.dart
+++ b/pkg/analyzer/lib/src/generated/error_verifier.dart
@@ -642,7 +642,13 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
DartType expectedReturnType = functionType == null
? DynamicTypeImpl.instance
: functionType.returnType;
- _checkForReturnOfInvalidType(node.expression, expectedReturnType);
+ bool isSetterWithImplicitReturn =
+ _enclosingFunction.hasImplicitReturnType &&
+ _enclosingFunction is PropertyAccessorElement &&
+ (_enclosingFunction as PropertyAccessorElement).isSetter;
+ if (!isSetterWithImplicitReturn) {
+ _checkForReturnOfInvalidType(node.expression, expectedReturnType);
+ }
return super.visitExpressionFunctionBody(node);
} finally {
_inAsync = wasInAsync;
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/strong_mode_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698