]> gitweb.factorcode.org Git - factor.git/blob - core/inference/errors/errors.factor
Merge branch 'master' of git://factorcode.org/git/factor
[factor.git] / core / inference / errors / errors.factor
1 ! Copyright (C) 2006, 2008 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 IN: inference.errors
4 USING: inference.backend inference.dataflow kernel generic
5 sequences prettyprint io words arrays inspector effects debugger
6 assocs accessors ;
7
8 M: inference-error error.
9     dup rstate>>
10     keys [ dup value? [ value-literal ] when ] map
11     dup empty? [ "Word: " write dup peek . ] unless
12     swap error>> error. "Nesting: " write . ;
13
14 M: inference-error error-help drop f ;
15
16 M: unbalanced-branches-error error.
17     "Unbalanced branches:" print
18     [ quots>> ] [ in>> ] [ out>> [ length ] map ] tri 3array flip
19     [ [ bl ] [ pprint ] interleave nl ] each ;
20
21 M: literal-expected summary
22     drop "Literal value expected" ;
23
24 M: too-many->r summary
25     drop
26     "Quotation pushes elements on retain stack without popping them" ;
27
28 M: too-many-r> summary
29     drop
30     "Quotation pops retain stack elements which it did not push" ;
31
32 M: no-effect error.
33     "Unable to infer stack effect of " write word>> . ;
34
35 M: no-recursive-declaration error.
36     "The recursive word " write
37     word>> pprint
38     " must declare a stack effect" print ;
39
40 M: effect-error error.
41     "Stack effects of the word " write
42     dup word>> pprint
43     " do not match." print
44     "Declared: " write
45     dup word>> stack-effect effect>string .
46     "Inferred: " write effect>> effect>string . ;
47
48 M: recursive-quotation-error error.
49     "The quotation " write
50     quot>> pprint
51     " calls itself." print
52     "Stack effect inference is undecidable when quotation-level recursion is permitted." print ;
53
54 M: cannot-unify-specials summary
55     drop
56     "Cannot unify branches with inconsistent special values" ;