Skip to content

Handle cross-package callable fields during QIR codegen#3470

Open
idavis wants to merge 6 commits into
mainfrom
iadavis/fix-cross-package-fir-codegen
Open

Handle cross-package callable fields during QIR codegen#3470
idavis wants to merge 6 commits into
mainfrom
iadavis/fix-cross-package-fir-codegen

Conversation

@idavis

@idavis idavis commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Fixes defunctionalization of callable fields flowing through constructors and factories, including across package boundaries.
  • Associates FIR transform diagnostics with their owning package so errors point to the correct source file.
  • Adds Rust, language service, and Python regression coverage for adaptive QIR generation and cross-package callables.

@idavis idavis self-assigned this Jul 15, 2026
@idavis idavis changed the title Fixes defunctionalization across packages Handle cross-package callable fields during QIR codegen Jul 15, 2026
@idavis
idavis force-pushed the iadavis/fix-cross-package-fir-codegen branch from 5fe46e2 to 6485174 Compare July 17, 2026 13:20
idavis added 4 commits July 17, 2026 06:20
…tors and factories, including across package boundaries, defers capability checks until after QIR transforms for string entry expressions.
@idavis
idavis force-pushed the iadavis/fix-cross-package-fir-codegen branch from 6485174 to a795900 Compare July 17, 2026 13:20
@idavis
idavis marked this pull request as ready for review July 17, 2026 14:24

assert_eq!(source.name.as_ref(), "lib.qs");
assert_eq!(&source.contents[span_start..span_end], "config.Apply(q)");
assert_ne!(source.name.as_ref(), "OutOfBounds");

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This check is technically redudant, since the name is already verified to be equal to "lib.qs" above.

Comment on lines +25 to +32
if let Some(unit) = store.get(package_id) {
WithSource::from_map(&unit.sources, diagnostic.error)
} else {
WithSource::from_map(
&SourceMap::default(),
qsc_fir_transforms::PipelineError::MissingDiagnosticSourcePackage(diagnostic.package),
)
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

while this is nicely defensive, I don't think this error case is needed. If the package id for the source of a transform error is not in the store, how did it get transformed in the first place? Seems like this can be changed to an expect and the MissingDiagnosticSourcePackage error removed entirely.

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