Skip to content

Commit

Permalink
Verify that mixin constraints can't be satisfied by the application (…
Browse files Browse the repository at this point in the history
…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 <paulberry@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
  • Loading branch information
stereotype441 authored and commit-bot@chromium.org committed Sep 26, 2018
1 parent 98a9adf commit c22b2ef
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/language_2/language_2_dartdevc.status
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions tests/language_2/language_2_kernel.status
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<M1>(null);
Expand Down

0 comments on commit c22b2ef

Please sign in to comment.