From bcebff2edc8a1ded61fa6f31b9080bae657aedc7 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Wed, 30 Mar 2022 23:06:46 -0700 Subject: Test of a package-related file compilation problem. This test currently fails. This problem was reported by Paul Patience, with a repro test case. The issue is that when compile-file is processing a (defpackage x ...) form, and the package x already exists, it fails to recognize the form as a package-manipulating form, and therefore fails to introduce a "fence" in the output so that subsequent material is placed into a new top-level object. The compiled image fo the (defun foo:fun ()) form in program.tl causes an error: the foo package does not exist. This is because the symbol foo:fun is being read as part of the same object which holds the compiled image of the defpackage form which defines the package. It's essentially the same problem as this (let () (defpackage :foo) foo:bar) The (defpackage ...) cannot execute until the entire form is read, but that form contains foo:bar which requires the foo package to exist. * tests/019/compile-package.tl: New file. * tests/019/data/program.tl: Likewise. --- tests/019/compile-package.tl | 7 +++++++ tests/019/data/program.tl | 5 +++++ 2 files changed, 12 insertions(+) create mode 100644 tests/019/compile-package.tl create mode 100644 tests/019/data/program.tl diff --git a/tests/019/compile-package.tl b/tests/019/compile-package.tl new file mode 100644 index 00000000..2028b913 --- /dev/null +++ b/tests/019/compile-package.tl @@ -0,0 +1,7 @@ +(defpackage :foo) + +(compile-file "data/program.tl") + +(delete-package :foo) + +(load "data/program.tlo") diff --git a/tests/019/data/program.tl b/tests/019/data/program.tl new file mode 100644 index 00000000..e97acbc5 --- /dev/null +++ b/tests/019/data/program.tl @@ -0,0 +1,5 @@ +(defpackage :foo (:fallback usr)) + +(in-package :foo) + +(defun foo:fun ()) -- cgit v1.2.3