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

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

Issue 2738113002: Add strong mode error for mixins defining conflicting private names (issue 28809) (Closed)
Patch Set: 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
« no previous file with comments | « pkg/analyzer/lib/src/generated/error_verifier.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 a8b21c9894860280119ed29c2eee7ebdb869c521..e8f7e11f19e915afe08ea9160608a8c5e050f691 100644
--- a/pkg/analyzer/test/generated/compile_time_error_code_test.dart
+++ b/pkg/analyzer/test/generated/compile_time_error_code_test.dart
@@ -5273,6 +5273,105 @@ f() {
verify([source]);
}
+ test_privateCollisionInMixinApplication_mixinAndMixin() async {
+ resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
+ addNamedSource(
+ '/lib1.dart',
+ '''
+class A {
+ int _x;
+}
+
+class B {
+ int _x;
+}
+''');
+ Source source = addSource('''
+import 'lib1.dart';
+class C extends Object with A, B {}
+''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [
+ CompileTimeErrorCode.PRIVATE_COLLISION_IN_MIXIN_APPLICATION,
+ StrongModeCode.INVALID_FIELD_OVERRIDE
+ ]);
+ verify([source]);
+ }
+
+ test_privateCollisionInMixinApplication_mixinAndMixin_indirect() async {
+ resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
+ addNamedSource(
+ '/lib1.dart',
+ '''
+class A {
+ int _x;
+}
+
+class B {
+ int _x;
+}
+''');
+ Source source = addSource('''
+import 'lib1.dart';
+class C extends Object with A {}
+class D extends C with B {}
+''');
+ await computeAnalysisResult(source);
+ assertErrors(
+ source, [CompileTimeErrorCode.PRIVATE_COLLISION_IN_MIXIN_APPLICATION]);
+ verify([source]);
+ }
+
+ test_privateCollisionInMixinApplication_superclassAndMixin() async {
+ resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
+ addNamedSource(
+ '/lib1.dart',
+ '''
+class A {
+ int _x;
+}
+
+class B {
+ int _x;
+}
+''');
+ Source source = addSource('''
+import 'lib1.dart';
+class C extends A with B {}
+''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [
+ CompileTimeErrorCode.PRIVATE_COLLISION_IN_MIXIN_APPLICATION,
+ StrongModeCode.INVALID_FIELD_OVERRIDE
+ ]);
+ verify([source]);
+ }
+
+ test_privateCollisionInMixinApplication_superclassAndMixin_same() async {
+ resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
+ addNamedSource(
+ '/lib1.dart',
+ '''
+class A {
+ int _x;
+}
+
+class B {
+ int _x;
+}
+''');
+ Source source = addSource('''
+import 'lib1.dart';
+class C extends A with A {}
+''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [
+ CompileTimeErrorCode.PRIVATE_COLLISION_IN_MIXIN_APPLICATION,
+ StrongModeCode.INVALID_FIELD_OVERRIDE
+ ]);
+ verify([source]);
+ }
+
test_privateOptionalParameter() async {
Source source = addSource("f({var _p}) {}");
await computeAnalysisResult(source);
« no previous file with comments | « pkg/analyzer/lib/src/generated/error_verifier.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698