From c22b2efb48950144fff02cea29eb2dce9e6b1a92 Mon Sep 17 00:00:00 2001 From: Paul Berry Date: Wed, 26 Sep 2018 13:07:04 +0000 Subject: [PATCH] Verify that mixin constraints can't be satisfied by the application (or named class) itself. When I first began working on the feature I mistakenly thought that these two test cases would be free from compile-time errors, so it seemed like it would be worth adding a test case to make sure others don't have the same misunderstanding. Change-Id: I322991c818f9d136180de443090fa4e15f6f0e27 Reviewed-on: https://dart-review.googlesource.com/76680 Commit-Queue: Paul Berry Reviewed-by: Lasse R.H. Nielsen --- tests/language_2/language_2_dartdevc.status | 2 ++ tests/language_2/language_2_kernel.status | 6 ++++++ ...in_declaration_invalid_application_supertype_test.dart | 8 ++++++++ 3 files changed, 16 insertions(+) diff --git a/tests/language_2/language_2_dartdevc.status b/tests/language_2/language_2_dartdevc.status index 96ca48f363a6c..7bba7f68390ed 100644 --- a/tests/language_2/language_2_dartdevc.status +++ b/tests/language_2/language_2_dartdevc.status @@ -320,6 +320,8 @@ mixin_declaration/mixin_declaration_inference_invalid_11_test: MissingCompileTim mixin_declaration/mixin_declaration_invalid_application_supertype_test/03: MissingCompileTimeError mixin_declaration/mixin_declaration_invalid_application_supertype_test/04: MissingCompileTimeError mixin_declaration/mixin_declaration_invalid_application_supertype_test/05: MissingCompileTimeError +mixin_declaration/mixin_declaration_invalid_application_supertype_test/06: MissingCompileTimeError +mixin_declaration/mixin_declaration_invalid_application_supertype_test/07: MissingCompileTimeError mixin_declaration/mixin_declaration_invalid_override_test/06: MissingCompileTimeError mixin_declaration/mixin_declaration_invalid_override_test/07: MissingCompileTimeError mixin_declaration/mixin_declaration_invalid_override_test/08: MissingCompileTimeError diff --git a/tests/language_2/language_2_kernel.status b/tests/language_2/language_2_kernel.status index 06c9b611943e3..3d5e04f960d57 100644 --- a/tests/language_2/language_2_kernel.status +++ b/tests/language_2/language_2_kernel.status @@ -87,6 +87,8 @@ main_test/03: RuntimeError mixin_declaration/mixin_declaration_invalid_application_supertype_test/03: MissingCompileTimeError mixin_declaration/mixin_declaration_invalid_application_supertype_test/04: MissingCompileTimeError mixin_declaration/mixin_declaration_invalid_application_supertype_test/05: MissingCompileTimeError +mixin_declaration/mixin_declaration_invalid_application_supertype_test/06: MissingCompileTimeError +mixin_declaration/mixin_declaration_invalid_application_supertype_test/07: MissingCompileTimeError mixin_declaration/mixin_declaration_invalid_override_test/none: CompileTimeError mixin_declaration/mixin_declaration_invalid_superinvocation_test/10: CompileTimeError mixin_declaration/mixin_declaration_invalid_superinvocation_test/none: CompileTimeError @@ -208,6 +210,8 @@ implicit_creation/implicit_const_not_default_values_test/e8: MissingCompileTimeE mixin_declaration/mixin_declaration_invalid_application_supertype_test/03: MissingCompileTimeError mixin_declaration/mixin_declaration_invalid_application_supertype_test/04: MissingCompileTimeError mixin_declaration/mixin_declaration_invalid_application_supertype_test/05: MissingCompileTimeError +mixin_declaration/mixin_declaration_invalid_application_supertype_test/06: MissingCompileTimeError +mixin_declaration/mixin_declaration_invalid_application_supertype_test/07: MissingCompileTimeError mixin_declaration/mixin_declaration_invalid_override_test/none: CompileTimeError mixin_declaration/mixin_declaration_invalid_superinvocation_test/10: CompileTimeError mixin_declaration/mixin_declaration_invalid_superinvocation_test/none: CompileTimeError @@ -2097,6 +2101,8 @@ generic_test/01: MissingCompileTimeError mixin_declaration/mixin_declaration_invalid_application_supertype_test/03: MissingCompileTimeError mixin_declaration/mixin_declaration_invalid_application_supertype_test/04: MissingCompileTimeError mixin_declaration/mixin_declaration_invalid_application_supertype_test/05: MissingCompileTimeError +mixin_declaration/mixin_declaration_invalid_application_supertype_test/06: MissingCompileTimeError +mixin_declaration/mixin_declaration_invalid_application_supertype_test/07: MissingCompileTimeError mixin_declaration/mixin_declaration_invalid_override_test/none: CompileTimeError mixin_declaration/mixin_declaration_invalid_superinvocation_test/10: CompileTimeError mixin_declaration/mixin_declaration_invalid_superinvocation_test/none: CompileTimeError diff --git a/tests/language_2/mixin_declaration/mixin_declaration_invalid_application_supertype_test.dart b/tests/language_2/mixin_declaration/mixin_declaration_invalid_application_supertype_test.dart index 584003c629380..08e33a66dba1e 100644 --- a/tests/language_2/mixin_declaration/mixin_declaration_invalid_application_supertype_test.dart +++ b/tests/language_2/mixin_declaration/mixin_declaration_invalid_application_supertype_test.dart @@ -26,6 +26,14 @@ mixin M2 on UnaryNum, UnaryInt {} class _ = UnaryInt with M2; //# 04: compile-time error class _ = UnaryNum with M2; //# 05: compile-time error +// Note that it is not sufficient for the application to declare that it +// implements the super-interface. +abstract class _ = Object with M1 implements UnaryNum; //# 06: compile-time error + +// Nor is it sufficient, in the case of an anonymous mixin application, for the +// containing class to declare that it implements the super-interface. +abstract class _ extends Object with M1 implements UnaryNum {} //# 07: compile-time error + main() { // M1 and M2 are valid types. Expect.notType(null);