summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin.mock/packages/multimethod/package.py
diff options
context:
space:
mode:
Diffstat (limited to 'var/spack/repos/builtin.mock/packages/multimethod/package.py')
-rw-r--r--var/spack/repos/builtin.mock/packages/multimethod/package.py26
1 files changed, 25 insertions, 1 deletions
diff --git a/var/spack/repos/builtin.mock/packages/multimethod/package.py b/var/spack/repos/builtin.mock/packages/multimethod/package.py
index a8e3d4995a..738e41be41 100644
--- a/var/spack/repos/builtin.mock/packages/multimethod/package.py
+++ b/var/spack/repos/builtin.mock/packages/multimethod/package.py
@@ -124,4 +124,28 @@ class Multimethod(MultimethodBase):
#
@when("@2:")
def base_method(self):
- return "subclass_method"
+ return 'multimethod'
+
+ #
+ # Make sure methods with non-default implementations in a superclass
+ # will invoke those methods when none in the subclass match but one in
+ # the superclass does.
+ #
+ @when("@1.0")
+ def inherited_and_overridden(self):
+ return "base@1.0"
+
+ @when("@2.0")
+ def inherited_and_overridden(self):
+ return "base@2.0"
+
+ #
+ # Make sure that multimethods follow MRO properly with diamond inheritance
+ #
+ @when('@2.0')
+ def diamond_inheritance(self):
+ return 'first_parent'
+
+ @when('@4.0')
+ def diamond_inheritance(self):
+ return "should_not_be_reached"