summaryrefslogtreecommitdiff
path: root/test-suite/tests/tree-il.test
AgeCommit message (Collapse)AuthorFilesLines
2020-03-06Fix expansion of 'error' primitive with a non-constant argument.Ludovic Courtès1-2/+36
Fixes <https://bugs.gnu.org/39509>. Reported by Klaus Stehle <klaus.stehle@uni-tuebingen.de>. * module/language/tree-il/primitives.scm (error): Remove extra "?" argument when the first argument is not a constant. * test-suite/tests/tree-il.test ("primitives")["error"]: New test prefix.
2019-09-12Use "G_" as the conventional alias for gettextAndy Wingo1-5/+5
Since the change in 2.2 noted in the NEWS as "Fix literal matching for module-bound literals", defining `_' makes `syntax-rules' and `match' fail to recognize `_' as the catch-all literal. This change adapts the recommendations to current practice in 2.2, as users have had to adapt to this change. * doc/ref/api-i18n.texi (Gettext Support): Update documentation. * module/language/tree-il/analyze.scm (proc-ref?, gettext?): G_ is the conventional abbreviation, not _. * test-suite/tests/tree-il.test: Adapt. * module/ice-9/command-line.scm: Use G_ instead of _.
2019-08-18Add "mod" field to tree-il toplevel ref, set, defineAndy Wingo1-3/+3
Add "mod" field to <toplevel-ref>, <toplevel-set>, and <toplevel-define>, indicating the expander's idea of what the current module is when a toplevel variable is accessed or created. This will help in later optimizations. * libguile/expand.c (TOPLEVEL_REF, TOPLEVEL_SET, TOPLEVEL_DEFINE) (expand, expand_define, expand_set_x, convert_assignment): * libguile/expand.h (SCM_EXPANDED_TOPLEVEL_REF_FIELD_NAMES): (SCM_MAKE_EXPANDED_TOPLEVEL_REF, SCM_EXPANDED_TOPLEVEL_SET_FIELD_NAMES): (SCM_MAKE_EXPANDED_TOPLEVEL_SET, SCM_EXPANDED_TOPLEVEL_DEFINE_FIELD_NAMES): (SCM_MAKE_EXPANDED_TOPLEVEL_DEFINE): * module/ice-9/compile-psyntax.scm (translate-literal-syntax-objects): * module/ice-9/psyntax-pp.scm: * module/ice-9/psyntax.scm: * module/language/tree-il.scm: * module/language/tree-il.scm (parse-tree-il, make-tree-il-folder): (pre-post-order): * module/language/tree-il/analyze.scm (goops-toplevel-definition): (macro-use-before-definition-analysis, proc-ref?, format-analysis): * module/language/tree-il/compile-cps.scm (convert): * module/language/tree-il/debug.scm (verify-tree-il): * module/language/tree-il/effects.scm (make-effects-analyzer): * module/language/tree-il/fix-letrec.scm (free-variables): * module/language/tree-il/peval.scm (peval): * test-suite/tests/tree-il.test: Adapt uses.
2018-08-07Add -Wshadowed-toplevel.Ludovic Courtès1-1/+83
* module/language/tree-il/analyze.scm (shadowed-toplevel-analysis): New variable. * module/language/tree-il/compile-cps.scm (%warning-passes): Add it. * module/system/base/message.scm (%warning-types): Add it. * test-suite/tests/tree-il.test ("warnings")["shadowed-toplevel"]: New test prefix. * module/ice-9/boot-9.scm (%auto-compilation-options): Add it. * doc/ref/api-evaluation.texi (Compilation): Add 'shadowed-toplevel' and 'macro-use-before-definition'.
2014-09-30Merge branch 'stable-2.0'Mark H Weaver1-4/+46
Conflicts: benchmark-suite/benchmarks/ports.bm libguile/async.h libguile/bytevectors.c libguile/foreign.c libguile/gsubr.c libguile/srfi-1.c libguile/vm-engine.h libguile/vm-i-scheme.c module/Makefile.am module/language/tree-il/analyze.scm module/language/tree-il/peval.scm module/scripts/compile.scm module/scripts/disassemble.scm test-suite/tests/asm-to-bytecode.test test-suite/tests/peval.test test-suite/tests/rdelim.test
2014-08-26Handle ~p in 'format' warnings.Ludovic Courtès1-0/+44
Fixes <http://bugs.gnu.org/18299>. Reported by Frank Terbeck <ft@bewatermyfriend.org>. * module/language/tree-il/analyze.scm (format-string-argument-count): Add case for ~p. * test-suite/tests/tree-il.test ("warnings")["format"]("~p", "~p, too few arguments", "~:p", "~:@p, too many arguments", "~:@p, too few arguments"): New tests.
2014-02-08Merge commit '0ce224594ae5a673f6a397c284db5f5a61935334'Andy Wingo1-2/+4
2014-02-07Improve handling of locales in the test suite.Mark H Weaver1-2/+4
* test-suite/guile-test (run-tests): Load each test file within (with-locale "C" ...). * test-suite/tests/encoding-iso88591.test: * test-suite/tests/encoding-iso88597.test: * test-suite/tests/encoding-utf8.test: * test-suite/tests/srfi-14.test: Remove broken code to save and restore the previous locale. * test-suite/tests/bytevectors.test: * test-suite/tests/format.test: * test-suite/tests/regexp.test: * test-suite/tests/srfi-19.test: * test-suite/tests/tree-il.test: Make sure 'setlocale' is defined before calling it.
2013-11-08Tree-IL warnings tests compile to CPS instead of "assembly"Andy Wingo1-100/+100
* test-suite/tests/tree-il.test ("warnings"): Change warnings test to compile to CPS instead of assembly.
2013-11-08Remove tree-il->glil test casesAndy Wingo1-578/+8
* test-suite/tests/tree-il.test: Remove GLIL test cases. They have never been helpful to me in the 2.0 series, so there is no loss.
2013-11-05squish to primitive reificationAndy Wingo1-4/+9
* test-suite/tests/tree-il.test: Update for primitive-ref reification fix.
2013-06-27remove @call-with-current-continuation memoizerAndy Wingo1-3/+3
* module/ice-9/boot-9.scm (call-with-current-continuation): Change to primcall call-with-current-continuation. * libguile/memoize.h: * libguile/expand.c (scm_sym_atcall_cc): Remove. * libguile/memoize.c (memoize): Memoize call/cc primcalls to SCM_M_CONT. (m_call_cc): Remove. (unmemoize): Unmemoize to call-with-current-continuation. * module/language/tree-il/compile-glil.scm (flatten-lambda-case): Update to call-with-current-continuation without @ prefix, and fix fallback case. * module/language/tree-il/primitives.scm (*multiply-valued-primitives*): (*interesting-primitive-names*): Remove @call-with-current-continuation. (call/cc): Expand to call-with-current-continuation. * test-suite/tests/tree-il.test ("call/cc"): Update to use and expect call-with-current-continuation primcalls / toplevel refs.
2013-06-27remove @apply memoizerAndy Wingo1-3/+3
* libguile/memoize.c (memoize): Recognize a primcall to 'apply as SCM_M_APPLY. (@apply): Remove @apply memoizer. (unmemoize): Unmemoize using "apply", not "@apply". * libguile/memoize.h: * libguile/expand.c (scm_sym_atapply): Remove. * module/ice-9/boot-9.scm (apply): Re-implement using apply primcall. Use case-lambda, so as to give an appropriate minimum arity. * module/language/tree-il/compile-glil.scm (flatten-lambda-case): Compile a primcall of "apply" specially, not "@apply". * module/language/tree-il/peval.scm (peval): Match primcalls to "apply", not "@apply". Residualize "apply" primcalls. * module/language/tree-il/primitives.scm (*interesting-primitive-names*): (*multiply-valued-primitives*): Remove @apply, and apply primitive expander. * test-suite/tests/peval.test: * test-suite/tests/tree-il.test: Update tests to expect residualized "apply". * test-suite/tests/procprop.test ("procedure-arity"): Update test for better apply arity. * test-suite/tests/strings.test ("string"): Update expected error.
2013-06-10Implement tree-il-fold in terms of make-tree-il-folder.Andy Wingo1-19/+16
* module/language/tree-il.scm (tree-il-fold): Implement using make-tree-il-folder. This is an incompatible change: there is no more "leaf" procedure, and tree-il-fold only works on tree-il and not lists. * module/language/tree-il/analyze.scm (<tree-analysis>, analyze-tree): Adapt to tree-il-fold change, losing the "leaf" handler. (unused-variable-analysis, unused-toplevel-analysis) (unbound-variable-analysis, arity-analysis): Adapt to tree-analysis change. * module/language/tree-il/canonicalize.scm (tree-il-any) * module/language/tree-il/cse.scm (build-assigned-var-table) * module/language/tree-il/peval.scm (tree-il-any, build-var-table) (peval): Adapt to tree-il-fold change. * test-suite/tests/tree-il.test ("tree-il-fold"): Adapt tests for new interface and expectations.
2013-06-10Pre-order tree-il rewrites are now non-destructiveAndy Wingo1-1/+1
* module/language/tree-il.scm (pre-order): Re-implement in terms of pre-post-order, and rename from pre-order!. * module/language/tree-il/primitives.scm (expand-primitives): Adapt to pre-order change, and rename from expand-primitives!. * module/language/tree-il/optimize.scm (optimize): Adapt to expand-primitives! change, and rename from optimize!. * module/language/tree-il/compile-glil.scm: * module/system/repl/common.scm: * test-suite/tests/cse.test: * test-suite/tests/peval.test: * test-suite/tests/tree-il.test: Adapt to expand-primitives and optimize changes.
2013-06-10Tree-il post-order rewriter no longer destructiveAndy Wingo1-3/+5
* module/language/tree-il.scm (pre-post-order): New helper, like pre-order! and post-order! but not destructive. (post-order): Implement in terms of pre-post-order, and rename from post-order!. * module/ice-9/compile-psyntax.scm (squeeze-tree-il): * module/language/tree-il/canonicalize.scm (canonicalize): * module/language/tree-il/fix-letrec.scm (fix-letrec): * module/language/tree-il/primitives.scm (resolve-primitives): Use post-order, and rename from the destructive variants (squeeze-tree-il!, canonicalize!, etc). Adapt callers. * test-suite/tests/tree-il.test (strip-source): Adapt to post-order. * test-suite/tests/cse.test: * test-suite/tests/peval.test: * module/language/tree-il/optimize.scm: Adapt callers.
2013-03-28Merge remote-tracking branch 'origin/stable-2.0'Mark H Weaver1-1/+17
Conflicts: configure.ac libguile/deprecated.c libguile/deprecated.h libguile/filesys.h libguile/fluids.c libguile/fports.c libguile/gc.c libguile/guile.c libguile/numbers.c libguile/objcodes.c libguile/r6rs-ports.c libguile/smob.c libguile/socket.c libguile/threads.h module/language/scheme/decompile-tree-il.scm module/language/tree-il/peval.scm test-suite/tests/syncase.test
2013-03-07support calls and tail-calls with more than 255 formalsAndy Wingo1-1/+17
* module/language/tree-il/compile-glil.scm (flatten-lambda-case): Support calls and tail-calls with more than 255 formals. * test-suite/tests/tree-il.test ("many args"): Add a test.
2013-01-31Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo1-2/+27
Conflicts: module/ice-9/psyntax-pp.scm module/ice-9/psyntax.scm module/language/bytecode/spec.scm module/language/tree-il/spec.scm
2013-01-28Fix argument count for various format string escape sequences.Ian Price1-2/+27
* module/language/tree-il/analyze.scm (format-string-argument-count): Handle ~t and ~k options case-insensitively. ~! ~| ~/ ~q and ~Q should not update the min-count or max-count. ~^ returns the min-count and 'any + - # and ' should not increase the argument count. * test-suite/tests/tree-il.test (*): Tests for new parameters.
2013-01-07Merge remote-tracking branch 'origin/stable-2.0'Mark H Weaver1-1/+71
Conflicts: GUILE-VERSION libguile/posix.c module/ice-9/eval.scm test-suite/tests/cse.test
2012-11-23Add tests for `-Wduplicate-case-datum' and `-Wbad-case-datum'.Ludovic Courtès1-1/+71
* test-suite/tests/tree-il.test (%opts-w-duplicate-case-datum, %opts-w-bad-case-datum): New variables. ("warnings")["duplicate-case-datum", "bad-case-datum"]: New tests.
2012-10-30Merge remote-tracking branch 'origin/stable-2.0'Mark H Weaver1-0/+82
Moved scm_i_struct_hash from struct.c to hash.c and made it static. The port's alist is now a field of 'scm_t_port'. Conflicts: libguile/arrays.c libguile/hash.c libguile/ports.c libguile/print.h libguile/read.c
2012-10-08Simplify calls to 'eqv?' when one argument is an immediate constant.Mark H Weaver1-21/+53
* module/language/tree-il/primitives.scm (maybe-simplify-to-eq): New helper procedure shared by expanders for 'eqv?' and 'equal?'. (*primitive-expand-table*): Add expansion rule for 'eqv?'. * test-suite/tests/tree-il.test ("primitives"): Add tests.
2012-10-08Don't simplify 'equal?' to 'not' or 'null?'.Mark H Weaver1-4/+4
* module/language/tree-il/primitives.scm (*primitive-expand-table*): Don't simplify 'equal?' to 'not' or 'null?', but only to 'eq?'. * test-suite/tests/tree-il.test ("primitives"): Adjust tests.
2012-10-07Don't simplify 'equal?' to 'eq?' when constant is an *inexact* small integer.Mark H Weaver1-0/+4
* module/language/tree-il/primitives.scm (*primitive-expand-table*): Refine test for fixnums to verify that the small integer is exact. * test-suite/tests/tree-il.test ("primitives"): Add test.
2012-10-06Simplify calls to `equal?' when one argument is a constant.Ludovic Courtès1-0/+46
* module/language/tree-il/primitives.scm (*primitive-expand-table*): Add expansion rules for `equal?', when called with one constant and another argument. * test-suite/tests/tree-il.test (pass-if-primitives-resolved): New macro. ("primitives"): New test prefix.
2012-05-21Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo1-0/+45
Conflicts: module/language/tree-il/analyze.scm module/language/tree-il/effects.scm module/language/tree-il/fix-letrec.scm module/language/tree-il/peval.scm test-suite/tests/cse.test test-suite/tests/peval.test
2012-05-12Have `-Wformat' remain quiet for any procedure called `_' or `N_'.Ludovic Courtès1-0/+9
* module/language/tree-il/analyze.scm (proc-ref?)[special?]: New procedure. Return #t for any toplevel-ref of `_'. * test-suite/tests/tree-il.test ("warnings")["format"]("non-literal format string using gettext as top-level _"): New test.
2012-05-12Have `-Warity-mismatch' handle applicable structs.Ludovic Courtès1-0/+20
* module/language/tree-il/analyze.scm (arity-analysis): Honor applicable structs. * test-suite/tests/tree-il.test ("warnings")["arity mismatch"]("top-level applicable struct", "top-level applicable struct with wrong arguments"): New tests.
2012-05-12Improve special-casing of `_' in `-Wformat'.Ludovic Courtès1-0/+16
* module/language/tree-il/analyze.scm (proc-ref?): Check for SPECIAL-NAME in the <module-ref> and <lexical-ref> cases too. * test-suite/tests/tree-il.test ("warnings")["format"]("non-literal format string using gettext as module-ref _", "non-literal format string using gettext as lexical _"): New tests.
2012-04-26Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo1-1/+1
Conflicts: test-suite/tests/cse.test
2012-04-26Merge commit 'de1eb420a5a95b17e85b19c4d98c869036e9ecb0'Andy Wingo1-978/+0
Conflicts: module/language/tree-il/primitives.scm test-suite/tests/tree-il.test
2012-04-26Merge commit 'd10f7b572c0ca1ccef87f9c46069daa30946e0cf'Andy Wingo1-7/+0
Conflicts: libguile/smob.c libguile/smob.h test-suite/tests/tree-il.test
2012-04-23enable cseAndy Wingo1-1/+1
* module/language/tree-il/optimize.scm: Enable CSE unless #:cse? #f is passed. * test-suite/tests/tree-il.test: Disable CSE for one test.
2012-04-23peval tests into separate fileAndy Wingo1-965/+0
* test-suite/tests/tree-il.test ("partial evaluation"): * test-suite/tests/peval.test ("partial evaluation"): Separate peval * tests. * test-suite/Makefile.am: Adapt.
2012-04-22Remove duplicate test in `tree-il.test'.Ludovic Courtès1-7/+0
* test-suite/tests/tree-il.test ("partial evaluation"): Remove duplicate test for `(cons 0 (cons 1 (cons 2 (list 3 4 5))))'.
2012-03-26Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo1-1/+9
Conflicts: libguile/procprop.c libguile/smob.c libguile/smob.h libguile/vm.c module/language/tree-il/primitives.scm
2012-03-23primitive resolution for public refsBT Templeton1-1/+9
* module/language/tree-il/primitives.scm (resolve-primitives!): Resolve public module-refs to primitives. * test-suite/tests/tree-il.test: New tests for primitive resolution.
2012-03-02Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo1-12/+9
2012-03-02tweaks to -Wformat's gettext detectionAndy Wingo1-12/+9
* module/language/tree-il/analyze.scm (proc-ref?): Change to use less false-if-exception and more variable-bound?. If a variable is present in the local module but not bound, assume that it is gettext if it has the right name. This is to allow for (define _ gettext). * test-suite/tests/tree-il.test ("warnings"): Update (_ "foo") example.
2012-03-02Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo1-1/+48
There are a some failures currently: FAIL: tree-il.test: warnings: format: non-literal format string with forward declaration ERROR: srfi-18.test: current-exception-handler: current handler returned at top level - arguments: ((wrong-type-arg "car" "Wrong type argument in position ~A (expecting ~A): ~S" (1 "pair" #<unspecified>) (#<unspecified>))) ERROR: srfi-18.test: current-exception-handler: multiple levels of handler nesting - arguments: ((wrong-type-arg "car" "Wrong type argument in position ~A (expecting ~A): ~S" (1 "pair" #<unspecified>) (#<unspecified>))) ERROR: srfi-18.test: current-exception-handler: exception handler installation is thread-safe - arguments: ((wrong-type-arg "car" "Wrong type argument in position ~A (expecting ~A): ~S" (1 "pair" #<unspecified>) (#<unspecified>))) Conflicts: module/language/tree-il/peval.scm module/language/tree-il/primitives.scm test-suite/tests/tree-il.test
2012-03-02peval: inline applications of lambda to rest argsAndy Wingo1-6/+14
* module/language/tree-il/peval.scm (peval): Add optimization to hoist the inner procedure out of e.g. (lambda args (apply (lambda ...) args)) This commit restores the ability to detect escape-only prompts at compile-time. * test-suite/tests/tree-il.test: Update test for prompt with a lambda, and add a specific test for lambda application.
2012-03-02more general treatment of call-with-promptAndy Wingo1-0/+29
* module/language/tree-il/primitives.scm (*primitive-expand-table*): Don't limit the call-with-prompt to <prompt> transition to lambda expressions. Instead we can lexically bind the handler, and rely on peval to propagate a lambda expression.
2012-02-27Avoid failure when `format-analysis' stumbles upon unbound variables.Ludovic Courtès1-0/+13
* module/language/tree-il/analyze.scm (proc-ref?): Wrap `variable-ref' in `false-if-exception'. * test-suite/tests/tree-il.test ("warnings")["format"]("non-literal format string with forward declaration"): New test.
2012-02-23Merge remote-tracking branch 'local-2.0/stable-2.0'Andy Wingo1-1/+41
Conflicts: module/language/tree-il/analyze.scm
2012-02-20Optimize Equality PrimitivesNoah Lavine1-0/+10
* module/language/tree-il/primitives.scm: add equality-primitive?, which is true for eq?, eqv?, and equal? * module/language/tree-il/peval.scm: if an equality primitive is applied to the same variable twice, fold it to #t * test-suite/tests/tree-il.test: add tests for pevaling equality primitives
2012-02-19Have `-Wformat' recognize `ngettext' calls.Ludovic Courtès1-0/+24
* module/language/tree-il/analyze.scm (gettext?): Rename to... (proc-ref?): ... this. Add `proc' and `special-name' parameters. (gettext?): Define in terms of `proc-ref?'. (ngettext?): New procedure. (const-fmt): Recognize `ngettext' calls. (format-analysis)[<down>](check-format-args]: Check constant-but-non-string 2nd argument in the (not (const-fmt ...)) case. [check-simple-format-args]: Use `const-fmt'. * test-suite/tests/tree-il.test ("warnings")["format"]("non-literal format string using ngettext", "non-literal format string using ngettext as N_"): New tests. ("simple-format")["unsupported, ngettext"]: New test.
2012-02-19Have `-Wformat' better recognize the `gettext' procedure.Ludovic Courtès1-1/+17
Fixes <http://bugs.gnu.org/10846>. Reported by Bruno Haible <bruno@clisp.org>. * module/language/tree-il/analyze.scm (gettext?): New procedure. (const-fmt): Add `env' parameter; update callers. Use `gettext?'. (format-analysis)[check-simple-format-args]: Actually support gettextized format strings. * test-suite/tests/tree-il.test ("warnings")["format"]("non-literal format string using gettext"): Use `gettext' as the procedure name. ("non-literal format string using gettext as _"): New test. ["simple-format"]("unsupported, gettext"): New test.
2012-02-11Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo1-11/+8
Conflicts: libguile/read.c test-suite/tests/tree-il.test