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

feat: Update remaining code to use new diagnostics #606

Merged
merged 14 commits into from
Nov 11, 2024

Conversation

mark-koch
Copy link
Collaborator

No description provided.

@mark-koch mark-koch requested a review from a team as a code owner October 29, 2024 16:11
@mark-koch mark-koch requested review from croyzor and removed request for a team October 29, 2024 16:11
raise GuppyError("Could not find a caller for the `@guppy` decorator")
raise RuntimeError("Could not find a caller for the `@guppy` decorator")
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Guppy errors are now reserved for things that go wrong during compilation. This error is thrown immediately when the user calls the decorator, so we shouldn't use GuppyError

Same for other errors in this file

@codecov-commenter
Copy link

codecov-commenter commented Oct 29, 2024

Codecov Report

Attention: Patch coverage is 78.08219% with 16 lines in your changes missing coverage. Please review.

Project coverage is 92.51%. Comparing base (c4a2aca) to head (2b69b80).

Files with missing lines Patch % Lines
guppylang/compiler/expr_compiler.py 20.00% 4 Missing ⚠️
guppylang/prelude/_internal/checker.py 80.00% 4 Missing ⚠️
guppylang/decorator.py 50.00% 3 Missing ⚠️
guppylang/module.py 40.00% 3 Missing ⚠️
guppylang/cfg/builder.py 89.47% 2 Missing ⚠️
Additional details and impacted files
@@                 Coverage Diff                  @@
##           feat/diagnostics     #606      +/-   ##
====================================================
+ Coverage             92.26%   92.51%   +0.25%     
====================================================
  Files                    66       66              
  Lines                  7462     7286     -176     
====================================================
- Hits                   6885     6741     -144     
+ Misses                  577      545      -32     

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

@@ -310,11 +310,6 @@ def custom(

def dec(f: PyFunc) -> RawCustomFunctionDef:
func_ast, docstring = parse_py_func(f, self._sources)
if not has_empty_body(func_ast):
Copy link
Collaborator

Choose a reason for hiding this comment

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

What's going on here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I moved this check to RawCustomFunctionDef.check since it doesn't really belong into the decorator imo

things: str

@dataclass(frozen=True)
class Suggestion(Help):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this error ever going to be created without adding this Help?

raise GuppyError(
f"Builtin method `{self.func.name}` is not supported by Guppy", self.node
)
err = UnsupportedError(self.node, f"Builtin method `{self.func.name}`")
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this should be singular=True

raise GuppyError(
f"Builtin method `{self.func.name}` is not supported by Guppy", self.node
)
err = UnsupportedError(self.node, f"Builtin method `{self.func.name}`")
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this should be singular=True

Copy link
Collaborator

@croyzor croyzor left a comment

Choose a reason for hiding this comment

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

New errors are looking very nice!

I'm seeing a lot of a pattern where an error declares a subdiagnostic as a nested class, which is added by the caller. Can we not define classes with default subdiagnostics?

@mark-koch
Copy link
Collaborator Author

I'm seeing a lot of a pattern where an error declares a subdiagnostic as a nested class, which is added by the caller. Can we not define classes with default subdiagnostics?

I like the idea 👍 I created issue #620 to implement this

Base automatically changed from diag/defs to feat/diagnostics November 11, 2024 13:48
@mark-koch mark-koch merged commit 130282d into feat/diagnostics Nov 11, 2024
2 checks passed
@mark-koch mark-koch deleted the diag/rest branch November 11, 2024 14:04
github-merge-queue bot pushed a commit that referenced this pull request Nov 11, 2024
This is the development branch for our new diagnostics infrastructure.
Tracked by #535.

*  #548
* #551
* #552 
* #553
* #586
* #588
* #587
* #589 
* #590
* #600
* #601
* #604 
* #605 
* #606
github-merge-queue bot pushed a commit that referenced this pull request Nov 12, 2024
🤖 I have created a release *beep* *boop*
---


## [0.13.0](v0.12.2...v0.13.0)
(2024-11-12)


### ⚠ BREAKING CHANGES

* `prelude` module renamed to `std`

### Features

* add `qubit` discard/measure methods
([#580](#580))
([242fa44](242fa44))
* Add `SizedIter` wrapper type
([#611](#611))
([2e9da6b](2e9da6b))
* conventional results post processing
([#593](#593))
([db96224](db96224))
* Improve compiler diagnostics
([#547](#547))
([90d465d](90d465d)),
closes [#551](#551)
[#553](#553)
[#586](#586)
[#588](#588)
[#587](#587)
[#590](#590)
[#600](#600)
[#601](#601)
[#606](#606)
* restrict result tag sizes to 256 bytes
([#596](#596))
([4e8e00f](4e8e00f)),
closes [#595](#595)


### Bug Fixes

* Mock guppy decorator during sphinx builds
([#622](#622))
([1cccc04](1cccc04))


### Documentation

* Add DEVELOPMENT.md
([#584](#584))
([1d29d39](1d29d39))
* Fix docs build ([#639](#639))
([bd6011c](bd6011c))


### Miscellaneous Chores

* Manually set last release commit
([#643](#643))
([b2d569b](b2d569b))


### Code Refactoring

* rename prelude to std
([#642](#642))
([1a68e8e](1a68e8e))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: Agustín Borgna <agustin.borgna@quantinuum.com>
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