Fail unification if no match for a selector
Mon Nov 23 13:19:59 UTC 2009 pix@kepibu.org
* Fail unification if no match for a selector
diff -rN -u old-Oh, Ducks!/notes new-Oh, Ducks!/notes
--- old-Oh, Ducks!/notes 2013-07-22 16:06:17.000000000 +0000
+++ new-Oh, Ducks!/notes 2013-07-22 16:06:17.000000000 +0000
@@ -109,8 +109,6 @@
I also recommend submitting a patch. Other people might want to use
that selector, too!
-* Known Bugs
-** Failure to match results in NIL, rather than a unification-failure
* To Do
** working lhtml/xmls support [1/2]
* [X] non-descendant cases (class, id, etc.)
diff -rN -u old-Oh, Ducks!/tests.lisp new-Oh, Ducks!/tests.lisp
--- old-Oh, Ducks!/tests.lisp 2013-07-22 16:06:17.000000000 +0000
+++ new-Oh, Ducks!/tests.lisp 2013-07-22 16:06:17.000000000 +0000
@@ -53,7 +53,7 @@
"<div>I do <i>not</i> <i>like</i> cheese.</div><div><span>I like <i>cheese</i>.</span></div>")
(values div i))
-#+FIXME ;; should throw 'unification-failure
+;; throws 'unification-failure
(match (#T(html (:model dom)
("q" . ?div))
"<div>I do <i>not</i> <i>like</i> cheese.</div><div><span>I like <i>cheese</i>.</span></div>")
diff -rN -u old-Oh, Ducks!/unify.lisp new-Oh, Ducks!/unify.lisp
--- old-Oh, Ducks!/unify.lisp 2013-07-22 16:06:17.000000000 +0000
+++ new-Oh, Ducks!/unify.lisp 2013-07-22 16:06:17.000000000 +0000
@@ -20,6 +20,10 @@
(t
(let ((val (find-matching-elements css-specifier document)))
(cond
+ ((null val)
+ (error 'unification-failure
+ :format-control "Unable to unify ~s and ~s"
+ :format-arguments (list css-specifier template)))
((unify::template-p template)
(unify template val env))
((unify::variablep template)