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

Unified Diff: pkg/analyzer/test/generated/resolver_test.dart

Issue 1531313002: fix #25280, treat setters as returning void in strong mode (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years 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
Index: pkg/analyzer/test/generated/resolver_test.dart
diff --git a/pkg/analyzer/test/generated/resolver_test.dart b/pkg/analyzer/test/generated/resolver_test.dart
index fa4338d94762abdcea34eb0a568bf1fa1ddbd028..7e965fad74be8800b9ad2655d6842dc25944be9d 100644
--- a/pkg/analyzer/test/generated/resolver_test.dart
+++ b/pkg/analyzer/test/generated/resolver_test.dart
@@ -13220,6 +13220,36 @@ main() {
expect(declaration.initializer.propagatedType, isNull);
}
+ void test_setterWithNoVoidType() {
Brian Wilkerson 2015/12/17 17:58:00 In addition to the explicit 'dynamic' case, we sho
Jennifer Messerly 2016/01/05 00:42:44 Good catch. Done & done.
+ Source source = addSource(r'''
+class A {
+ set f(String s) {
+ return '42';
+ }
+}
+set g(int x) => 42;
+''');
+ computeLibrarySourceErrors(source);
+ assertErrors(source, [
+ StaticTypeWarningCode.RETURN_OF_INVALID_TYPE,
+ StaticTypeWarningCode.RETURN_OF_INVALID_TYPE
+ ]);
+ verify([source]);
+ }
+
+ void test_setterWithNoVoidType_returningVoid() {
+ Source source = addSource(r'''
+void returnsVoid() {}
+class A {
+ set f(String s) => returnsVoid();
+}
+set g(int x) => returnsVoid();
+''');
+ computeLibrarySourceErrors(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
void test_ternaryOperator_null_left() {
String code = r'''
main() {

Powered by Google App Engine
This is Rietveld 408576698