Repository navigation
fix: an imported predicate goes by the name it was written with - #15
Merged
Merged
Conversation
A self-checking program states the statement an assertion is reported with (a new '# Expect: statement' line), and a verifier fixture applies an imported predicate to the wrong number of arguments. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An import gives the predicates it brings in a prefixed name (Numbers of
lib/numbers.l becomes Numbers_Numbers), and that name reached the user: in
errors ('Numbers_Numbers' has 1 column...) and in assertion reports
(Numbers_Numbers.positive). Errors, warnings and reports now name a
predicate as it was written — the name the main file imports it under, or
its own in its file — and compile, search, plan and counterexamples take
that name. A written name that is already taken keeps its prefix.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follows #14, which was merged before its fixtures were pushed.
Problem
An import gives the predicates it brings in a prefixed name (
Numbersoflib/numbers.lbecomesNumbers_Numbers). That name is the compiler's, and it reached the user:Fix
predicate_names): the name the main file imports it under (its alias, if any), or its own name in its file.check,assertionsand the errors ofcompile,search,planandcounterexamplesname predicates that way.compile,search,planandcounterexamplestake the written name too, so what a report prints is what a command accepts.Tests
.lfixtures:tests/verifier_tests/fixtures/114_assertions_imported_predicate_wrong_arity.l(withlib/numbers.l)tests/programs/assertions/80_statement_is_quoted_as_written.l(new# Expect: statementline)tests/programs/assertions/81_error_names_an_imported_predicate_as_written.ltests/programs/assertions/82_alias_is_the_written_name.l56_imported_predicate.land71_assertion_inside_an_imported_file.lnow expect the written names.Plus unit tests for the name mapping and two Python tests (alias, and a name already taken). The parser's reference comparison ignores
predicate_names, as it doesimported_predicates.cargo test --lib: 831 passed.cargo test --no-default-features --tests: all pass (verifier 100/100).pytest tests/cli: 550 passed, 33 skipped.🤖 Generated with Claude Code