-
-
Notifications
You must be signed in to change notification settings - Fork 3
🚀 Clear assertion greyed-out lines on restart and highlight issue locations #232
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
base: main
Are you sure you want to change the base?
Changes from all commits
6fd5af1
8accf50
f4b0038
f7f27bd
0cca5ca
a5c3eca
5222682
7e82180
e4155c4
64de683
732ca9b
1e99c96
88de5e5
057b5dd
1bed4cc
cc2c09b
ad1fe09
cd4dba9
c3ca4b9
e43e740
36fdd37
aa92b5f
051fd1e
261d3b0
f6a5878
8018667
3dbd364
2cd3395
135fd94
b50cab1
bbc0cbb
ec901ce
1d1d848
ebe4cec
4b50146
465d447
50da634
7398f50
ea89e07
5d3f383
e8e9f40
ffe1a38
817e49e
c6b102f
1cefe3e
e10b1a0
ceaedcf
52ad47a
84c38f1
0d12f43
3ca8940
543bd22
9f13bd2
4ff44db
8e3b801
d1c343e
59680cb
5532817
b6e4152
ac21598
3e02a97
a7b5ce1
c8b03ee
59af8a0
687bc9b
ddc8b45
4e67409
7308dab
42a4bcf
86cc5c9
5160144
7e0c3df
68a8ffe
a7c6b72
8ef979f
83e928a
47edfc0
7b8fa09
ec64afd
32d14d8
b734fc1
92f4b4b
81801fa
e151e5d
d5cd2e7
ff0e4b3
f2d9c9d
8d6d7f0
fbb9bd1
3653c60
4bb141e
62ea2cc
9563c25
4c34277
ccfd5bb
8663fbe
c256690
cf270eb
489592b
4de1403
29607af
5a7413f
9d98879
a8c25e2
15bb5d9
175bb08
f53a848
d406d13
65f230c
55ad6b9
3169e22
090de19
c6faa23
b2c0b2b
6b15941
6fec6a9
af49c19
03920d7
efbcd5c
160c294
70897c1
4695b89
7e40ed9
9349194
2f77e27
6b9c1d7
c1eaccd
fa522a6
1f5e0ca
0e6bfa8
09f5ace
4f3e00d
f2d905c
819d0f4
a70891c
dd89f76
5822fbd
adecd22
0f9fd53
50abd27
8e20311
5b5037e
526da85
13731ab
1cf068f
a3d385e
4283c11
3ab0733
c7da6a3
8a07f36
6ce28c0
7ea1084
0606738
fdfd0c8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -62,6 +62,41 @@ struct StatevectorCPP { | |||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| // NOLINTNEXTLINE(misc-use-internal-linkage) | ||||||||||||||||||||||||||||||||||||||
| void bindFramework(nb::module_& m) { | ||||||||||||||||||||||||||||||||||||||
| // Bind the Result enum | ||||||||||||||||||||||||||||||||||||||
| nb::enum_<Result>(m, "Result", "Represents the result of an operation.") | ||||||||||||||||||||||||||||||||||||||
| .value("OK", OK, "Indicates that the operation was successful.") | ||||||||||||||||||||||||||||||||||||||
| .value("ERROR", ERROR, "Indicates that an error occurred."); | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| // Bind the LoadResultStatus enum | ||||||||||||||||||||||||||||||||||||||
| nb::enum_<LoadResultStatus>( | ||||||||||||||||||||||||||||||||||||||
| m, "LoadResultStatus", | ||||||||||||||||||||||||||||||||||||||
| "Represents the result of a code loading operation.") | ||||||||||||||||||||||||||||||||||||||
| .value("OK", LOAD_OK, "Indicates that the code was loaded successfully.") | ||||||||||||||||||||||||||||||||||||||
| .value("PARSE_ERROR", LOAD_PARSE_ERROR, | ||||||||||||||||||||||||||||||||||||||
| "Indicates that the code could not be parsed.") | ||||||||||||||||||||||||||||||||||||||
| .value("INTERNAL_ERROR", LOAD_INTERNAL_ERROR, | ||||||||||||||||||||||||||||||||||||||
| "Indicates that an internal error occurred while loading."); | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| // Bind the LoadResult struct | ||||||||||||||||||||||||||||||||||||||
| nb::class_<LoadResult>(m, "LoadResult") | ||||||||||||||||||||||||||||||||||||||
| .def(nb::init<>()) | ||||||||||||||||||||||||||||||||||||||
| .def_rw("status", &LoadResult::status, | ||||||||||||||||||||||||||||||||||||||
| "Indicates whether the load was successful and why it failed.") | ||||||||||||||||||||||||||||||||||||||
| .def_rw("line", &LoadResult::line, | ||||||||||||||||||||||||||||||||||||||
| "The line number of the error location, or 0 if unknown.") | ||||||||||||||||||||||||||||||||||||||
| .def_rw("column", &LoadResult::column, | ||||||||||||||||||||||||||||||||||||||
| "The column number of the error location, or 0 if unknown.") | ||||||||||||||||||||||||||||||||||||||
| .def_prop_ro( | ||||||||||||||||||||||||||||||||||||||
| "message", | ||||||||||||||||||||||||||||||||||||||
| [](const LoadResult& self) { | ||||||||||||||||||||||||||||||||||||||
| if (self.message == nullptr) { | ||||||||||||||||||||||||||||||||||||||
| return nb::none(); | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
| return nb::cast(std::string(self.message)); | ||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||
| "A human-readable error message, or None if none is available.") | ||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+89
to
+97
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Minor: Consider explicit return type for message lambda. The lambda returns ♻️ Optional: Explicit return type .def_prop_ro(
"message",
- [](const LoadResult& self) {
+ [](const LoadResult& self) -> nb::object {
if (self.message == nullptr) {
return nb::none();
}
return nb::cast(std::string(self.message));
},📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||
| .doc() = "The result of a code loading operation."; | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| // Bind the VariableType enum | ||||||||||||||||||||||||||||||||||||||
| nb::enum_<VariableType>(m, "VariableType", | ||||||||||||||||||||||||||||||||||||||
| "The type of a classical variable.") | ||||||||||||||||||||||||||||||||||||||
|
|
@@ -164,13 +199,16 @@ Contains one element for each of the `num_states` states in the state vector.)") | |||||||||||||||||||||||||||||||||||||
| .def( | ||||||||||||||||||||||||||||||||||||||
| "load_code", | ||||||||||||||||||||||||||||||||||||||
| [](SimulationState* self, const char* code) { | ||||||||||||||||||||||||||||||||||||||
| checkOrThrow(self->loadCode(self, code)); | ||||||||||||||||||||||||||||||||||||||
| return self->loadCode(self, code); | ||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||
| "code"_a, | ||||||||||||||||||||||||||||||||||||||
| R"(Loads the given code into the simulation state. | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| Args: | ||||||||||||||||||||||||||||||||||||||
| code: The code to load.)") | ||||||||||||||||||||||||||||||||||||||
| code: The code to load. | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| Returns: | ||||||||||||||||||||||||||||||||||||||
| LoadResult: The result of the load operation.)") | ||||||||||||||||||||||||||||||||||||||
| .def( | ||||||||||||||||||||||||||||||||||||||
| "step_forward", | ||||||||||||||||||||||||||||||||||||||
| [](SimulationState* self) { checkOrThrow(self->stepForward(self)); }, | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -42,6 +42,46 @@ typedef enum { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ERROR, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } Result; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * @brief The result of a code loading operation. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| typedef enum { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * @brief Indicates that the code was loaded successfully. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| LOAD_OK, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * @brief Indicates that the code could not be parsed. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| LOAD_PARSE_ERROR, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * @brief Indicates that an internal error occurred while loading the code. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| LOAD_INTERNAL_ERROR, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } LoadResultStatus; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * @brief The result of a code loading operation. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| typedef struct { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
svenjeschmitt-ops marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * @brief Indicates whether the load was successful and why it failed. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| LoadResultStatus status; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * @brief The line number of the error location, or 0 if unknown. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| size_t line; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * @brief The column number of the error location, or 0 if unknown. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| size_t column; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * @brief A human-readable error message, or nullptr if none is available. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const char* message; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+63
to
+82
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: # First, check if the file exists and read the relevant section
if [ -f "include/common.h" ]; then
echo "=== File found, reading lines 63-82 ==="
sed -n '63,82p' include/common.h
else
echo "File not found, searching for common.h"
find . -name "common.h" -type f | head -5
fiRepository: munich-quantum-toolkit/debugger Length of output: 607 🏁 Script executed: # Search for how NULL/nullptr are used in documentation throughout the codebase
echo "=== Checking NULL vs nullptr usage in comments ==="
rg "nullptr|NULL" include/ --type c --type h -B 2 -A 2 | head -50Repository: munich-quantum-toolkit/debugger Length of output: 2512 🏁 Script executed: # Check if this is a public C API header and how other fields are documented
echo "=== Checking for C API patterns and ownership documentation ==="
rg "@brief.*owned|@brief.*lifetime|ownership|lifetime" include/ --type hRepository: munich-quantum-toolkit/debugger Length of output: 138 🏁 Script executed: # Get broader context of the file to understand if it's C-facing
echo "=== Checking file context and includes ==="
head -30 include/common.hRepository: munich-quantum-toolkit/debugger Length of output: 780 Use The documentation uses 📝 Suggested doc fix- /**
- * `@brief` A human-readable error message, or nullptr if none is available.
- */
+ /**
+ * `@brief` A human-readable error message, or NULL if none is available.
+ *
+ * The pointer is owned by the library and should be copied immediately.
+ */
const char* message;📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } LoadResult; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * @brief The type of classical variables. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.