From 12d963f03a1a7fe15c3f8e8c636a517c215131bd Mon Sep 17 00:00:00 2001 From: Dave Watson Date: Wed, 15 Nov 2023 09:23:06 -0800 Subject: [PATCH] Closure conversion fix --- lib/passes.scm | 2 +- test/CMakeLists.txt | 2 ++ test/regression/closure.scm | 15 +++++++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 test/regression/closure.scm diff --git a/lib/passes.scm b/lib/passes.scm index 8522c9a..6565d6e 100644 --- a/lib/passes.scm +++ b/lib/passes.scm @@ -469,7 +469,7 @@ (define (generate-closure-set g clo) (define (find-closure f) (let loop ((groups groups) (closures closures)) - (let loop2 ((lams (map car groups))) + (let loop2 ((lams (car groups))) (if (null? lams) (loop (cdr groups) (cdr closures)) (if (eq? f (caar lams)) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 8b6ed1d..51bd513 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -230,3 +230,5 @@ set_tests_properties(bench2/mperm PROPERTIES PASS_REGULAR_EXPRESSION "CSVLINE") add_test(NAME bench2/equal WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/test COMMAND ${CMAKE_BINARY_DIR}/src/hawk bench2/equal.scm) set_tests_properties(bench2/equal PROPERTIES PASS_REGULAR_EXPRESSION "CSVLINE") +# Regression +add_test(NAME regression/closure WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/test COMMAND ${CMAKE_BINARY_DIR}/src/hawk regression/closure.scm) diff --git a/test/regression/closure.scm b/test/regression/closure.scm new file mode 100644 index 0000000..7c77a0f --- /dev/null +++ b/test/regression/closure.scm @@ -0,0 +1,15 @@ +(define (pp) + (define (pp-expr) + (style) + max-call-head-width) + (define (pp-do) pp-expr) + (define max-call-head-width 5) + (define (style) pp-do) + + (pp-expr)) + +(display (pp)) + + + +