always replace SELF when copying statements (#345)

This commit is contained in:
Daniel Gulotta 2025-07-22 14:56:37 -07:00 committed by GitHub
parent 5cdf53576b
commit 89dfc4e214
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 12 additions and 14 deletions

View file

@ -766,7 +766,7 @@ impl Params {
}
}
/// Replace references to SELF by `self_id` in anchored keys of the statement.
/// Replace references to SELF by `self_id`.
pub fn normalize_statement(statement: &Statement, self_id: PodId) -> Statement {
let predicate = statement.predicate();
let args = statement
@ -776,6 +776,9 @@ pub fn normalize_statement(statement: &Statement, self_id: PodId) -> Statement {
StatementArg::Key(AnchoredKey { pod_id, key }) if *pod_id == SELF => {
StatementArg::Key(AnchoredKey::new(self_id, key.clone()))
}
StatementArg::Literal(value) if value.raw.0 == SELF.0 .0 => {
StatementArg::Literal(self_id.into())
}
_ => sa.clone(),
})
.collect();