Skip to content

Commit

Permalink
Fix output type inference when using tags from optional scopes.
Browse files Browse the repository at this point in the history
  • Loading branch information
obi1kenobi committed Jul 2, 2024
1 parent 99d8189 commit 5a31e02
Show file tree
Hide file tree
Showing 29 changed files with 1,585 additions and 82 deletions.
4 changes: 2 additions & 2 deletions trustfall_core/src/frontend/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,9 +293,9 @@ impl FilterTypeError {
/// the tag name separately if needed.
fn represent_argument(argument: &Argument, tag_name: Option<&str>) -> String {
match argument {
Argument::Tag(tag) => Self::represent_tag_name_and_type(
Argument::Tag(tag, ..) => Self::represent_tag_name_and_type(
tag_name.expect("tag argument without a name"),
tag.field_type(),
argument.field_type(),
),
Argument::Variable(var) => {
Self::represent_variable_name_and_type(&var.variable_name, &var.variable_type)
Expand Down
8 changes: 4 additions & 4 deletions trustfall_core/src/frontend/filters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ use crate::{
use super::{
error::{FilterTypeError, FrontendError},
tags::{TagHandler, TagLookupError},
util::ComponentPath,
util::QueryPath,
};

#[allow(clippy::too_many_arguments)]
pub(super) fn make_filter_expr(
schema: &Schema,
component_path: &ComponentPath,
query_path: &QueryPath,
tags: &mut TagHandler<'_>,
current_vertex_vid: Vid,
left_operand: OperationSubject,
Expand All @@ -36,7 +36,7 @@ pub(super) fn make_filter_expr(
OperatorArgument::TagRef(tag_name) => {
let defined_tag = match tags.reference_tag(
tag_name.as_ref(),
component_path,
query_path,
current_vertex_vid,
) {
Ok(defined_tag) => defined_tag,
Expand All @@ -60,7 +60,7 @@ pub(super) fn make_filter_expr(
}
};

Argument::Tag(defined_tag.field.clone())
defined_tag.create_tag_argument(query_path)
}
})
},
Expand Down
Loading

0 comments on commit 5a31e02

Please sign in to comment.