Skip to content

Consolidate OpenQASM project loading and include handling #2512

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

Merged
merged 8 commits into from
Jun 10, 2025

Conversation

idavis
Copy link
Collaborator

@idavis idavis commented Jun 5, 2025

Replaces #2444

  • Unified project loading: Consolidated OpenQASM project loading across all components (compiler, language service, Python pip, WASM) to use a single load_openqasm_project method instead of multiple inconsistent approaches
  • Improved error handling: Enhanced include file error propagation by properly associating errors with their source spans and include statements in the parent file
  • Better error reporting: Include file errors now display with proper source location information, showing the problematic include statement in context instead of generic "Not Found" messages
  • API simplification:
    • Removed custom ImportResolver from Python interop in favor of unified project loading
    • Replaced multiple compile_to_qsharp_ast_with_config calls with parse_and_compile_to_qsharp_ast_with_config. With parsing, compilation, and project loading being separated, trying to clear up intent and purpose.
    • Added parse_sources utility function for handling multiple source files
  • Enhanced debugging support: Added test coverage for setting breakpoints in multi-file OpenQASM programs with included files
  • Code structure improvements:
    • Added Debug and Clone derives to semantic analysis types for better tooling support
    • Consolidated error handling logic into reusable helper functions
    • Improved span tracking for IO errors through the compilation pipeline

The changes ensure consistent OpenQASM project handling across VS Code extension, Python package, WASM builds, and language service while providing better error messages and debugging capabilities for multi-file projects.

@idavis idavis self-assigned this Jun 5, 2025
@idavis idavis force-pushed the iadavis/qasm-project-loading branch from 2ebe8ed to d9e26f4 Compare June 5, 2025 23:19
@idavis idavis force-pushed the iadavis/qasm-project-loading branch from d9e26f4 to 533d9e8 Compare June 6, 2025 19:50
Copy link
Member

@minestarks minestarks left a comment

Choose a reason for hiding this comment

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

Posting a round of comments. Still need to review language service and pip folders

@idavis idavis added this pull request to the merge queue Jun 10, 2025
Merged via the queue into main with commit 2279038 Jun 10, 2025
18 checks passed
@idavis idavis deleted the iadavis/qasm-project-loading branch June 10, 2025 19:02
@idavis idavis mentioned this pull request Jun 10, 2025
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.

3 participants