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

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

Issue 702623002: Properly restore context when leaving visitor functions in ErrorVerifier. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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/lib/src/generated/resolver.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/generated/compile_time_error_code_test.dart
diff --git a/pkg/analyzer/test/generated/compile_time_error_code_test.dart b/pkg/analyzer/test/generated/compile_time_error_code_test.dart
index c72aea82a30501ed1e67448407a5d8393c3b52ec..a3193bcc1d0d7f2f66f72b2c6b9dea4decb6ff40 100644
--- a/pkg/analyzer/test/generated/compile_time_error_code_test.dart
+++ b/pkg/analyzer/test/generated/compile_time_error_code_test.dart
@@ -2721,6 +2721,43 @@ class A<E> {
assertErrors(source, [CompileTimeErrorCode.INVALID_URI]);
}
+ void test_isInConstInstanceCreation_restored() {
+ // If ErrorVerifier._isInConstInstanceCreation is not properly restored on
+ // exit from visitInstanceCreationExpression, the error at (1) will be
+ // treated as a warning rather than an error.
+ Source source = addSource(r'''
+class Foo<T extends num> {
+ const Foo(x, y);
+}
+const x = const Foo<int>(const Foo<int>(0, 1),
+ const <Foo<String>>[]); // (1)
+''');
+ resolve(source);
+ assertErrors(source, [CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]);
+ verify([source]);
+ }
+
+ void test_isInInstanceVariableInitializer_restored() {
+ // If ErrorVerifier._isInInstanceVariableInitializer is not properly
+ // restored on exit from visitVariableDeclaration, the error at (1)
+ // won't be detected.
+ Source source = addSource(r'''
+class Foo {
+ var bar;
+ Map foo = {
+ 'bar': () {
+ var _bar;
+ },
+ 'bop': _foo // (1)
+ };
+ _foo() {
+ }
+}''');
+ resolve(source);
+ assertErrors(source, [CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER]);
+ verify([source]);
+ }
+
void test_labelInOuterScope() {
Source source = addSource(r'''
class A {
« no previous file with comments | « pkg/analyzer/lib/src/generated/resolver.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698