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

Side by Side Diff: pkg/analyzer/test/src/context/context_test.dart

Issue 2199903002: Create synthetic FieldElement(s) (don't use non-synthetic ones) for non-synthetic class getters/set… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library analyzer.test.src.context.context_test; 5 library analyzer.test.src.context.context_test;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 9
10 import 'package:analyzer/dart/ast/ast.dart'; 10 import 'package:analyzer/dart/ast/ast.dart';
(...skipping 3909 matching lines...) Expand 10 before | Expand all | Expand 10 after
3920 a, 3920 a,
3921 r''' 3921 r'''
3922 const A = 2; 3922 const A = 2;
3923 '''); 3923 ''');
3924 _assertInvalid(a, LIBRARY_ERRORS_READY); 3924 _assertInvalid(a, LIBRARY_ERRORS_READY);
3925 _assertInvalid(b, LIBRARY_ERRORS_READY); 3925 _assertInvalid(b, LIBRARY_ERRORS_READY);
3926 _assertInvalid(c, LIBRARY_ERRORS_READY); 3926 _assertInvalid(c, LIBRARY_ERRORS_READY);
3927 _assertInvalid(d, LIBRARY_ERRORS_READY); 3927 _assertInvalid(d, LIBRARY_ERRORS_READY);
3928 } 3928 }
3929 3929
3930 void test_sequence_duplicateField_syntheticAndNot_renameNotSynthetic() {
3931 context.analysisOptions =
3932 new AnalysisOptionsImpl.from(context.analysisOptions)
3933 ..strongMode = true;
3934 Source a = addSource(
3935 '/a.dart',
3936 r'''
3937 class A {
3938 int foo;
3939 int get foo => 1;
3940 }
3941 class B extends A {
3942 int get foo => 2;
3943 }
3944 ''');
3945 _performPendingAnalysisTasks();
3946 expect(context.getErrors(a).errors, hasLength(2));
3947 // Update a.dart: rename "int foo" to "int bar".
3948 // The strong mode "getter cannot override field" error is gone.
3949 context.setContents(
3950 a,
3951 r'''
3952 class A {
3953 int bar;
3954 int get foo => 1;
3955 }
3956 class B extends A {
3957 int get foo => 2;
3958 }
3959 ''');
3960 _performPendingAnalysisTasks();
3961 expect(context.getErrors(a).errors, isEmpty);
3962 }
3963
3930 void test_sequence_inBodyChange_addRef_deltaChange() { 3964 void test_sequence_inBodyChange_addRef_deltaChange() {
3931 Source a = addSource( 3965 Source a = addSource(
3932 '/a.dart', 3966 '/a.dart',
3933 r''' 3967 r'''
3934 class A { 3968 class A {
3935 } 3969 }
3936 '''); 3970 ''');
3937 Source b = addSource( 3971 Source b = addSource(
3938 '/b.dart', 3972 '/b.dart',
3939 r''' 3973 r'''
(...skipping 1043 matching lines...) Expand 10 before | Expand all | Expand 10 after
4983 * Initialize the visitor. 5017 * Initialize the visitor.
4984 */ 5018 */
4985 _ElementGatherer(); 5019 _ElementGatherer();
4986 5020
4987 @override 5021 @override
4988 void visitElement(Element element) { 5022 void visitElement(Element element) {
4989 elements[element] = element; 5023 elements[element] = element;
4990 super.visitElement(element); 5024 super.visitElement(element);
4991 } 5025 }
4992 } 5026 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/generated/all_the_rest_test.dart ('k') | pkg/analyzer/test/src/task/incremental_element_builder_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698