<< Back to previous view

[LOGIC-12] Improved warnings/errors for pattern matching Created: 30/Aug/11  Updated: 28/Jul/13  Resolved: 01/Sep/11

Status: Closed
Project: core.logic
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Enhancement Priority: Trivial
Reporter: Ambrose Bonnaire-Sergeant Assignee: David Nolen
Resolution: Completed Votes: 0
Labels: None

Attachments: Text File syntax-check.patch     Text File syntax-check-with-warn.patch    
Patch: Code
Approval: Ok


I've added some simple syntax checks for the pattern matching macros like matche.

clojure.core.logic.prelude=> (let [x 1]
(matche [x]
(1 [1 1] 1)))
#<CompilerException java.lang.RuntimeException: java.lang.Exception: Expecting vector of matches, instead 1, compiling:(REPL:53)>

clojure.core.logic.prelude=> (let [x 1]
(matche [x]
([1 1] 1)))
#<prelude$eval4469$fn_4471 clojure.core.logic.prelude$eval4469$fn_4471@e9ebe1>
WARNING: Differing number of matches. Matching [1 1] against [x]

clojure.core.logic.prelude=> (let [x 1]
([1 1] 1)))
#<CompilerException java.lang.Exception: Expecting vector of arguments, instead , compiling:(REPL:58)>

Attached patch.

Comment by Ambrose Bonnaire-Sergeant [ 30/Aug/11 9:01 AM ]

Whoops, the patch is missing the definition for "warn".

Comment by Ambrose Bonnaire-Sergeant [ 30/Aug/11 9:09 AM ]

Added correct patch.

Generated at Tue Sep 26 13:16:28 CDT 2017 using JIRA 4.4#649-r158309.