Skip to content
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

Allow for return type signature in @qjit methods #751

Merged
merged 2 commits into from
May 21, 2024

Conversation

erick-xanadu
Copy link
Contributor

Context: Methods with return type signatures are not compiled.

Description of the Change: At the moment, ignore the return type signature as it is computed by JAX.

Benefits: More valid python code is able to be compiled.

Possible Drawbacks: It would be nice to incorporate return type signature to the warning message if the detected return type is not the same as the one specified by the user. But we can leave this to the next PR.

Related GitHub Issues: Fixes #750

@erick-xanadu erick-xanadu requested a review from josh146 May 16, 2024 15:11
Copy link

codecov bot commented May 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.10%. Comparing base (5d7d1fd) to head (dbbfb89).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #751   +/-   ##
=======================================
  Coverage   98.10%   98.10%           
=======================================
  Files          69       69           
  Lines        9550     9555    +5     
  Branches      746      747    +1     
=======================================
+ Hits         9369     9374    +5     
  Misses        147      147           
  Partials       34       34           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@josh146
Copy link
Member

josh146 commented May 16, 2024

Possible Drawbacks: It would be nice to incorporate return type signature to the warning message if the detected return type is not the same as the one specified by the user. But we can leave this to the next PR.

@erick-xanadu my inclination is not to do this, because Python type hinting typically has no logical effect on code execution?

But rather, leave this to a user running static type analysis tools like mypy

@erick-xanadu
Copy link
Contributor Author

@josh146 alright! I haven't incorporated the warning nor any checking in this PR. This PR only makes it so that if a function is annotated with a return type signature, the function can still be compiled. Without this PR, we have an error when the function has a return type signature.

@erick-xanadu erick-xanadu requested a review from grwlf May 17, 2024 20:13
Copy link
Collaborator

@dime10 dime10 left a comment

Choose a reason for hiding this comment

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

Nice catch!

@erick-xanadu erick-xanadu merged commit a723cd1 into main May 21, 2024
41 checks passed
@erick-xanadu erick-xanadu deleted the eochoa/2024-05-16/fix-retval branch May 21, 2024 19:22
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.

Compiling with return signature raises an exception.
3 participants