From 92d4e87ab95c630c4a171b4847ba41dd229d3a3a Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Thu, 24 Mar 2016 17:44:58 +0100 Subject: [PATCH] raise a runtime error when unable to generate a sensible default collection binding we can't generate a static assertion so easily here. Problem is, when forming this type, we don't know if the user will override and provide a custom binding in some chained call within the nested DSL. Might still be able to come up with some clever trick, like e.g. returing an unsuitable marker type from these dummy default implementations and then, later on, when actually building the collection binding, to detect those marker types and rise a static assert at that point. This would at least give us a better error message, and in theory, it should always be possible to detect this kind of misuse at compile time --- src/lib/diff/tree-mutator-collection-binding.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/diff/tree-mutator-collection-binding.hpp b/src/lib/diff/tree-mutator-collection-binding.hpp index 741f8f3e5..3ed8e1d9b 100644 --- a/src/lib/diff/tree-mutator-collection-binding.hpp +++ b/src/lib/diff/tree-mutator-collection-binding.hpp @@ -404,15 +404,15 @@ struct _DefaultPayload { static bool - match (GenNode const& spec, ELM const& elm) + match (GenNode const&, ELM const&) { - UNIMPLEMENTED("lalü"); + throw error::Logic ("unable to build a sensible default matching predicate"); } static ELM - construct (GenNode const& spec) + construct (GenNode const&) { - UNIMPLEMENTED("lalü"); + throw error::Logic ("unable to build a sensible default for creating new elements"); } };