Skip to content

Fix include error span #2444

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

Closed
wants to merge 1 commit into from
Closed

Conversation

orpuente-MS
Copy link
Contributor

@orpuente-MS orpuente-MS commented May 21, 2025

Include error spans were set to the beginning of the file, since include errors were being pushed in resolution, where there is no knowledge of spans. This PR delays pushing IO errors until lowering, so that we can construct the error with the correct span.

@idavis idavis marked this pull request as draft May 22, 2025 22:37
github-merge-queue bot pushed a commit that referenced this pull request Jun 10, 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
Copy link
Collaborator

idavis commented Jun 10, 2025

Superseded by #2512

@idavis idavis closed this 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.

2 participants