Skip to content

Commit

Permalink
qualify InnerType
Browse files Browse the repository at this point in the history
  • Loading branch information
u9g committed Aug 6, 2023
1 parent 492bb85 commit eef6fa7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
8 changes: 4 additions & 4 deletions trustfall_core/src/frontend/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use crate::{
query::{parse_document, FieldConnection, FieldNode, Query},
},
ir::{
ty::{from_type, Type},
ty::{from_type, InnerType, Type},
types::{intersect_types, is_argument_type_valid, NamedTypedValue},
Argument, ContextField, EdgeParameters, Eid, FieldRef, FieldValue, FoldSpecificField,
FoldSpecificFieldKind, IREdge, IRFold, IRQuery, IRQueryComponent, IRVertex, IndexedQuery,
Expand Down Expand Up @@ -255,14 +255,14 @@ fn infer_variable_type(
// the property needs to be a list. If it's not a list, this is a bad filter.
let value = property_type.value();
let inner_type = match value {
crate::ir::ty::InnerType::NameOfType(_) => {
InnerType::NameOfType(_) => {
return Err(Box::new(FilterTypeError::ListFilterOperationOnNonListField(
operation.operation_name().to_string(),
property_name.to_string(),
property_type.to_string(),
)))
}
crate::ir::ty::InnerType::ListInnerType(inner) => inner,
InnerType::ListInnerType(inner) => inner,
};

// We're trying to see if a list of element contains our element, so its type
Expand Down Expand Up @@ -1160,7 +1160,7 @@ where
let tag_field = ContextField {
vertex_id: current_vid,
field_name: subfield.name.clone(),
field_type: subfield_raw_type.to_owned(),
field_type: subfield_raw_type.clone(),
};

// TODO: handle tags on non-fold-related transformed fields here
Expand Down
10 changes: 2 additions & 8 deletions trustfall_core/src/schema/adapter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -399,10 +399,7 @@ impl<'a> crate::interpreter::Adapter<'a> for SchemaAdapter<'a> {
"target" => resolve_neighbors_with(contexts, move |vertex| {
let vertex = vertex.as_edge().expect("not an Edge");
let edge_type = from_type(&vertex.defn.ty.node);
let target_type = {
let ty = &edge_type;
ty.base_named_type()
};
let target_type = edge_type.base_named_type();
Box::new(
schema
.vertex_types
Expand Down Expand Up @@ -513,10 +510,7 @@ fn resolve_vertex_type_property_edge<'a>(
Box::new(fields.iter().filter_map(move |p| {
let field = &p.node;
let field_ty = from_type(&field.ty.node);
let base_ty = {
let ty = &field_ty;
ty.base_named_type()
};
let base_ty = field_ty.base_named_type();

if !schema.vertex_types.contains_key(base_ty) {
Some(SchemaVertex::Property(Property::new(
Expand Down

0 comments on commit eef6fa7

Please sign in to comment.