]> Repositorios git - scryer-prolog.git/commit
Fix #2725 by calling load_context/1 in the unspecified branch of strip_module/3
authorEmilie Burgun <[email protected]>
Wed, 1 Jan 2025 16:27:40 +0000 (17:27 +0100)
committerEmilie Burgun <[email protected]>
Sun, 12 Jan 2025 13:08:28 +0000 (14:08 +0100)
commitb76bdd75e4b340719e437ba9ce7262a7527063f6
tree832c0cb932019b14836fd588057543a6154deb8d
parent1ed4fe655504b8b83c0ddd2fc2d65ebeebfd9781
Fix #2725 by calling load_context/1 in the unspecified branch of strip_module/3

This fixes #2725, by making it so that `strip_module(Pred, M, P), call(M:P)`
doesn't throw an `instanciation_error` when `Pred` isn't in the form `module:predicate`.

Now, `strip_module(hello, M, P)` will call `load_context(M)`, which unifies `M`
with the topmost module (or `user`).

Two new test cases are added: issue2725.pl, which tests the minimal case id(X) --> X.
and the strip_module(P, M, _), call(M:P) scenario, and module_resolution,
which tests the behavior of strip_module in a few scenarios.
src/lib/builtins.pl
src/loader.pl
src/machine/system_calls.rs
src/tests/module_resolution.pl [new file with mode: 0644]
tests-pl/issue2725.pl [new file with mode: 0644]
tests/scryer/cli/src_tests/module_resolution.stderr [new file with mode: 0644]
tests/scryer/cli/src_tests/module_resolution.stdout [new file with mode: 0644]
tests/scryer/cli/src_tests/module_resolution.toml [new file with mode: 0644]
tests/scryer/issues.rs