Skip to content

Conversation

xav-db
Copy link
Member

@xav-db xav-db commented Sep 1, 2025

Description

Related Issues

Closes #

Checklist when merging to main

  • No compiler warnings (if applicable)
  • Code is formatted with rustfmt
  • No useless or dead code (if applicable)
  • Code is easy to understand
  • Doc comments are used for all functions, enums, structs, and fields (where appropriate)
  • All tests pass
  • Performance has not regressed (assuming change was not to fix a bug)
  • Version number has been updated in helix-cli/Cargo.toml and helixdb/Cargo.toml

Additional Notes

@xav-db xav-db marked this pull request as ready for review September 1, 2025 21:57
@Copilot Copilot AI review requested due to automatic review settings September 1, 2025 21:57
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces support for object and array creation syntax in the HQL (Helix Query Language) return statements. The change extends the language's ability to construct complex return types directly in queries.

  • Adds new ReturnType enum to handle arrays, objects, and expressions in return statements
  • Implements parsing for array and object creation syntax in the grammar
  • Updates code generation to handle the new return value types

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
test_simple.hx Test file with incomplete expression
helix-db/src/protocol/return_values.rs Adds support for Vec conversion and removes unused code
helix-db/src/helixc/parser/helix_parser.rs Implements parsing for array/object creation with new ReturnType enum
helix-db/src/helixc/generator/return_values.rs Adds code generation for array and object return types
helix-db/src/helixc/generator/queries.rs Updates query generation with conditional parameter handling
helix-db/src/helixc/analyzer/methods/query_validation.rs Implements validation for new return types with recursive processing
helix-db/src/helixc/analyzer/analyzer.rs Updates analyzer to handle ReturnType enum changes
helix-db/src/grammar.pest Adds grammar rules for array_creation, object_creation, and related constructs
Comments suppressed due to low confidence (1)

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +2261 to +2263
_ => {
objects.push(ReturnType::Object(self.parse_object_creation(p)?));
}
Copy link
Preview

Copilot AI Sep 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This assumes all non-identifier rules are object_creation, which may not be correct. The code should explicitly match against Rule::object_creation and handle unexpected rules with an error.

Suggested change
_ => {
objects.push(ReturnType::Object(self.parse_object_creation(p)?));
}
Rule::object_creation => {
objects.push(ReturnType::Object(self.parse_object_creation(p)?));
}
_ => {
return Err(ParserError::from(format!(
"Unexpected rule in parse_array_creation: {:?}",
p.as_rule()
)));
}

Copilot uses AI. Check for mistakes.

Comment on lines 73 to +75
ReturnType::UnnamedExpr => todo!(),
ReturnType::HashMap => todo!(),
ReturnType::Array => todo!(),
Copy link
Preview

Copilot AI Sep 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These todo!() macros will cause runtime panics. Consider implementing these cases or returning a default value with a comment explaining the limitation.

Suggested change
ReturnType::UnnamedExpr => todo!(),
ReturnType::HashMap => todo!(),
ReturnType::Array => todo!(),
// These variants do not have an associated name; return a default value.
ReturnType::UnnamedExpr | ReturnType::HashMap | ReturnType::Array => "data".to_string(),

Copilot uses AI. Check for mistakes.

@xav-db xav-db merged commit 06ab743 into dev Sep 2, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant