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

Unified Diff: pkg/analyzer/test/src/task/strong/checker_test.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 | « pkg/analyzer/test/generated/strong_mode_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/src/task/strong/checker_test.dart
diff --git a/pkg/analyzer/test/src/task/strong/checker_test.dart b/pkg/analyzer/test/src/task/strong/checker_test.dart
index ec1f92c41174c251e272616a9bc772f8e3b2adac..dae9ab38d8e427bc692c43aa0119e30cc7738765 100644
--- a/pkg/analyzer/test/src/task/strong/checker_test.dart
+++ b/pkg/analyzer/test/src/task/strong/checker_test.dart
@@ -62,6 +62,24 @@ void main() {
''');
});
+ test('setter return types', () {
+ checkFile('''
+ void voidFn() => null;
+ class A {
+ set a(y) => 4;
+ set b(y) => voidFn();
+ void set c(y) => /*warning:RETURN_OF_INVALID_TYPE*/4;
+ void set d(y) => voidFn();
+ /*warning:NON_VOID_RETURN_FOR_SETTER*/int set e(y) => 4;
+ /*warning:NON_VOID_RETURN_FOR_SETTER*/int set f(y) => /*warning:RETURN_OF_INVALID_TYPE*/voidFn();
+ set g(y) {return /*warning:RETURN_OF_INVALID_TYPE*/4;}
+ void set h(y) {return /*warning:RETURN_OF_INVALID_TYPE*/4;}
+ /*warning:NON_VOID_RETURN_FOR_SETTER*/int set i(y) {return 4;}
+ }
+ ''');
+
+ });
+
test('if/for/do/while statements use boolean conversion', () {
checkFile('''
main() {
« no previous file with comments | « pkg/analyzer/test/generated/strong_mode_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698