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

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

Issue 2625783002: Explicitly compute analysis results for sources to check errors. (Closed)
Patch Set: Created 3 years, 11 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
Index: pkg/analyzer/test/generated/strong_mode_test.dart
diff --git a/pkg/analyzer/test/generated/strong_mode_test.dart b/pkg/analyzer/test/generated/strong_mode_test.dart
index cf4cd1d93a8926f5b748578de9dbd6ec60b0aee4..880c4728b77d66aa26144499ad1973b0bdc3ae6e 100644
--- a/pkg/analyzer/test/generated/strong_mode_test.dart
+++ b/pkg/analyzer/test/generated/strong_mode_test.dart
@@ -5,6 +5,7 @@
library analyzer.test.generated.strong_mode_test;
import 'dart:async';
+
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/ast/standard_resolution_map.dart';
import 'package:analyzer/dart/element/element.dart';
@@ -685,6 +686,7 @@ class StrongModeDownwardsInferenceTest extends ResolverTestCase {
}
''');
resolve2(source);
+ await computeAnalysisResult(source);
await assertNoErrors(source);
verify([source]);
}
@@ -1328,16 +1330,6 @@ void test/*<S>*/(/*=T*/ pf/*<T>*/(/*=T*/ e)) {
expectIdentifierType('paramTearOffInst', "(int) → int");
}
- Future<Null> _objectMethodOnFunctions_helper2(String code) async {
- await resolveTestUnit(code);
- expectIdentifierType('t0', "String");
- expectIdentifierType('t1', "() → String");
- expectIdentifierType('t2', "int");
- expectIdentifierType('t3', "String");
- expectIdentifierType('t4', "() → String");
- expectIdentifierType('t5', "int");
- }
-
void setUp() {
super.setUp();
AnalysisOptionsImpl options = new AnalysisOptionsImpl();
@@ -1814,6 +1806,7 @@ class C {
class D extends C {
String f/*<S>*/(/*=S*/ x) => null;
}''');
+ await computeAnalysisResult(source);
await assertErrors(source, [StrongModeCode.INVALID_METHOD_OVERRIDE]);
verify([source]);
}
@@ -1828,6 +1821,7 @@ class C {
class D extends C {
/*=T*/ f/*<T extends B>*/(/*=T*/ x) => null;
}''');
+ await computeAnalysisResult(source);
await assertErrors(source, [StrongModeCode.INVALID_METHOD_OVERRIDE]);
verify([source]);
}
@@ -1840,6 +1834,7 @@ class C {
class D extends C {
/*=S*/ f/*<T, S>*/(/*=T*/ x) => null;
}''');
+ await computeAnalysisResult(source);
await assertErrors(source, [StrongModeCode.INVALID_METHOD_OVERRIDE]);
verify([source]);
}
@@ -2081,6 +2076,7 @@ class A {
}
dynamic set g(int x) => null;
''');
+ await computeAnalysisResult(source);
await assertErrors(source, [
StaticWarningCode.NON_VOID_RETURN_FOR_SETTER,
StaticWarningCode.NON_VOID_RETURN_FOR_SETTER
@@ -2096,6 +2092,7 @@ class A {
}
void set g(int x) => returnsVoid();
''');
+ await computeAnalysisResult(source);
await assertNoErrors(source);
verify([source]);
}
@@ -2109,6 +2106,7 @@ class A {
}
set g(int x) => 42;
''');
+ await computeAnalysisResult(source);
await assertErrors(source, [
StaticTypeWarningCode.RETURN_OF_INVALID_TYPE,
]);
@@ -2123,6 +2121,7 @@ class A {
}
set g(int x) => returnsVoid();
''');
+ await computeAnalysisResult(source);
await assertNoErrors(source);
verify([source]);
}
@@ -2134,6 +2133,7 @@ class A {
}
Object set g(x) => null;
''');
+ await computeAnalysisResult(source);
await assertErrors(source, [
StaticWarningCode.NON_VOID_RETURN_FOR_SETTER,
StaticWarningCode.NON_VOID_RETURN_FOR_SETTER
@@ -2160,6 +2160,16 @@ main() {
await resolveTestUnit(code);
expectInitializerType('foo', 'int', isNull);
}
+
+ Future<Null> _objectMethodOnFunctions_helper2(String code) async {
+ await resolveTestUnit(code);
+ expectIdentifierType('t0', "String");
+ expectIdentifierType('t1', "() → String");
+ expectIdentifierType('t2', "int");
+ expectIdentifierType('t3', "String");
+ expectIdentifierType('t4', "() → String");
+ expectIdentifierType('t5', "int");
+ }
}
@reflectiveTest

Powered by Google App Engine
This is Rietveld 408576698