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

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

Issue 2786993002: Convert top-level inference errors to hints (Closed)
Patch Set: Preserve the new hints Created 3 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
Index: pkg/analyzer/test/generated/hint_code_test.dart
diff --git a/pkg/analyzer/test/generated/hint_code_test.dart b/pkg/analyzer/test/generated/hint_code_test.dart
index fd3bf9d14e2c61a9496ebf342bae47d66225d04e..93ea7b340d16dbd44fe3fcd0bff55732f03d3b70 100644
--- a/pkg/analyzer/test/generated/hint_code_test.dart
+++ b/pkg/analyzer/test/generated/hint_code_test.dart
@@ -2499,10 +2499,10 @@ class C {
verify([source]);
}
- test_strongMode_downCastCompositeNoHint() async {
+ test_strongMode_downCastCompositeHint() async {
AnalysisOptionsImpl options = new AnalysisOptionsImpl();
options.strongMode = true;
- options.strongModeHints = false;
+ options.strongModeHints = true;
resetWith(options: options);
Source source = addSource(r'''
main() {
@@ -2511,14 +2511,14 @@ main() {
print(list);
}''');
await computeAnalysisResult(source);
- assertNoErrors(source);
+ assertErrors(source, [StrongModeCode.DOWN_CAST_COMPOSITE]);
verify([source]);
}
- test_strongMode_downCastCompositeHint() async {
+ test_strongMode_downCastCompositeNoHint() async {
AnalysisOptionsImpl options = new AnalysisOptionsImpl();
options.strongMode = true;
- options.strongModeHints = true;
+ options.strongModeHints = false;
resetWith(options: options);
Source source = addSource(r'''
main() {
@@ -2527,7 +2527,7 @@ main() {
print(list);
}''');
await computeAnalysisResult(source);
- assertErrors(source, [StrongModeCode.DOWN_CAST_COMPOSITE]);
+ assertNoErrors(source);
verify([source]);
}
@@ -2554,6 +2554,20 @@ main() {
verify([source]);
}
+ test_strongMode_topLevelInstanceGetter() async {
+ resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
+ Source source = addSource(r'''
+class A {
+ int get g => 0;
+}
+var a = new A();
+var b = a.g;
+''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [StrongModeCode.TOP_LEVEL_INSTANCE_GETTER]);
+ verify([source]);
+ }
+
test_typeCheck_type_is_Null() async {
Source source = addSource(r'''
m(i) {

Powered by Google App Engine
This is Rietveld 408576698