Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Trieste and fix API breakage #161

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pr_gate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Run clang-format style check
uses: jidicula/clang-format-action@v4.8.0
with:
clang-format-version: '13'
clang-format-version: '18'
check-path: ${{matrix.path['check']}}
exclude-regex: ${{matrix.path['exclude']}}

Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ FetchContent_Declare(
FetchContent_Declare(
trieste
GIT_REPOSITORY https://github.com/microsoft/trieste
GIT_TAG 7cd90387ac2de6423ed1dc43496273b0a20a03d4
GIT_TAG 7ddc75733bc74ee43b98d4999fe15045f4115f69
)

FetchContent_MakeAvailable(cmake_utils)
Expand Down
2 changes: 1 addition & 1 deletion src/internal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ namespace rego
return false;
}

return is_in(node->parent()->shared_from_this(), types);
return is_in(node->parent(), types);
}

bool is_constant(const Node& term)
Expand Down
6 changes: 3 additions & 3 deletions src/reader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -665,17 +665,17 @@ namespace
}};

pass.pre(Comma, [comma_groups](Node node) {
comma_groups->insert(node->parent());
comma_groups->insert(node->parent_unsafe());
return 0;
});

pass.pre(Colon, [colon_groups](Node node) {
colon_groups->insert(node->parent());
colon_groups->insert(node->parent_unsafe());
return 0;
});

pass.pre(Or, [or_groups](Node node) {
auto group = node->parent();
auto group = node->parent_unsafe();
auto pos = group->find(node);
for (auto it = group->begin(); it != pos; ++it)
{
Expand Down
4 changes: 2 additions & 2 deletions src/rego_c.cc
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ extern "C"
logging::Debug() << "regoNodeJSONSize";
auto node_ptr = reinterpret_cast<trieste::NodeDef*>(node);
trieste::WFContext context(rego::wf_result);
std::string json = rego::to_key(node_ptr->shared_from_this(), true);
std::string json = rego::to_key(node_ptr->intrusive_ptr_from_this(), true);
return static_cast<regoSize>(json.size() + 1);
}

Expand All @@ -562,7 +562,7 @@ extern "C"

auto node_ptr = reinterpret_cast<trieste::NodeDef*>(node);
trieste::WFContext context(rego::wf_result);
std::string json = rego::to_key(node_ptr->shared_from_this(), true);
std::string json = rego::to_key(node_ptr->intrusive_ptr_from_this(), true);
if (size < json.size() + 1)
{
return REGO_ERROR_BUFFER_TOO_SMALL;
Expand Down
3 changes: 1 addition & 2 deletions src/unifier.cc
Original file line number Diff line number Diff line change
Expand Up @@ -411,8 +411,7 @@ namespace rego
"Recursion detected in rule body: " + std::string(m_rule.view()));
}

logging::Debug() << "=====Unification====="
<< "exprs: " << m_statements;
logging::Debug() << "=====Unification=====" << "exprs: " << m_statements;

{
logging::LocalIndent indent;
Expand Down
2 changes: 1 addition & 1 deletion src/unify.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ namespace rego
return name.find("query$") != std::string::npos;
}

return in_query(node->parent()->shared_from_this());
return in_query(node->parent());
}

bool contains_local(const Node& node)
Expand Down
2 changes: 1 addition & 1 deletion src/unify/absolute_refs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace
return Ref << (RefHead << (Var ^ "data")) << refargseq;
}

Node ref = build_ref(leaf->parent()->shared_from_this());
Node ref = build_ref(leaf->parent());

if (leaf->type() == Policy || leaf->type() == DataModule)
{
Expand Down
10 changes: 5 additions & 5 deletions src/unify/enumerate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace
find_all_refs_in(local->scope(), (local / Var)->location(), refs);
for (auto& ref : refs)
{
if (ref->parent() == local.get())
if (ref->parent() == local)
{
continue;
}
Expand Down Expand Up @@ -61,7 +61,7 @@ namespace

Node next_enum(Node local)
{
Node unifybody = local->parent()->shared_from_this();
Node unifybody = local->parent();
auto it = unifybody->find(local) + 1;
return find_enum(unifybody, it);
}
Expand Down Expand Up @@ -302,21 +302,21 @@ namespace rego
if (is_in(local, {LiteralEnum}))
{
// should this local be defined here?
Node unifybody = local->parent()->shared_from_this();
Node unifybody = local->parent();
bool requires_move = false;
while (!should_be_defined_in(local, unifybody))
{
// we need to keep popping out of nested enums until we find the
// correct scope
requires_move = true;
NodeDef* literalenum = unifybody->parent();
Node literalenum = unifybody->parent();
if (literalenum->type() != LiteralEnum)
{
// we've popped out of the nested enums
break;
}

unifybody = literalenum->parent()->shared_from_this();
unifybody = literalenum->parent();
}

if (requires_move)
Expand Down
6 changes: 3 additions & 3 deletions src/unify/lift_refheads.cc
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ namespace
return;
}

Node module = node->parent()->parent()->shared_from_this();
Node module = node->parent()->parent();
Node prefix_ref = concat_refs(Var ^ "data", (module / Package)->front());
if (prefix_ref->type() == Error)
{
Expand Down Expand Up @@ -316,7 +316,7 @@ namespace rego
}) >>
[refheads](Match& _) {
ACTION();
Node module = _(Rule)->parent()->parent()->shared_from_this();
Node module = _(Rule)->parent()->parent();
Node imports = (module / ImportSeq)->clone();
Node package_ref = (module / Package)->front();
Node version = (module / Version)->clone();
Expand Down Expand Up @@ -374,7 +374,7 @@ namespace rego
});

lift_refheads.post(Rule, [refheads](Node node) {
Node module = node->parent()->parent()->shared_from_this();
Node module = node->parent()->parent();
Node rulehead = node / RuleHead;
Node package_ref = (module / Package)->front();
Node prefix_ref = concat_refs(Var ^ "data", package_ref);
Expand Down
4 changes: 2 additions & 2 deletions src/unify/lift_to_rule.cc
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ namespace
}
}

Node get_version(NodeDef* node)
Node get_version(Node node)
{
if (node == Top)
{
Expand All @@ -151,7 +151,7 @@ namespace
return (*it)->clone();
}

return err(node->shared_from_this(), "Missing version");
return err(node, "Missing version");
}

return get_version(node->parent());
Expand Down
2 changes: 1 addition & 1 deletion src/unify/symbols.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace
auto it = module->find_first(Version, module->begin());
if (it == module->end())
{
return err(module->shared_from_this(), "No version found in module");
return err(module, "No version found in module");
}
return (*it)->clone();
}
Expand Down
Loading