From f7bd2b168939ba60d807f97bb86ffaa9cc4e42ec Mon Sep 17 00:00:00 2001 From: Thomas Alexander Date: Fri, 15 Mar 2024 19:27:04 -0300 Subject: [PATCH] Add unsupported input flag. --- include/API/errors.h | 1 + python_lib/qss_compiler/exceptions.py | 4 ++++ python_lib/qss_compiler/lib_enums.cpp | 1 + .../add-unsupported-openqasm3-input-a584bb990cd9c9ff.yaml | 6 ++++++ 4 files changed, 12 insertions(+) create mode 100644 releasenotes/notes/add-unsupported-openqasm3-input-a584bb990cd9c9ff.yaml diff --git a/include/API/errors.h b/include/API/errors.h index 4e7859c21..e5ac61f77 100644 --- a/include/API/errors.h +++ b/include/API/errors.h @@ -32,6 +32,7 @@ namespace qssc { enum class ErrorCategory { OpenQASM3ParseFailure, + OpenQASM3UnsupportedInput, QSSCompilerError, QSSCompilerNoInputError, QSSCompilerCommunicationFailure, diff --git a/python_lib/qss_compiler/exceptions.py b/python_lib/qss_compiler/exceptions.py index 41b057500..bff21fa99 100644 --- a/python_lib/qss_compiler/exceptions.py +++ b/python_lib/qss_compiler/exceptions.py @@ -119,3 +119,7 @@ class QSSControlSystemResourcesExceeded(QSSCompilerError): class OpenQASM3ParseFailure(QSSCompilerError): """Raised when a parser failure is received""" + + +class OpenQASM3UnsupportedInput(QSSCompilerError): + """Raised when provided Openqasm 3 input has semantics that are not supported by the compiler.""" diff --git a/python_lib/qss_compiler/lib_enums.cpp b/python_lib/qss_compiler/lib_enums.cpp index 3789afff5..e2ec63ded 100644 --- a/python_lib/qss_compiler/lib_enums.cpp +++ b/python_lib/qss_compiler/lib_enums.cpp @@ -15,6 +15,7 @@ void addErrorCategory(py::module &m) { py::enum_(m, "ErrorCategory", py::arithmetic()) .value("OpenQASM3ParseFailure", qssc::ErrorCategory::OpenQASM3ParseFailure) + .value("OpenQASM3UnsupportedInput", qssc::ErrorCategory::OpenQASM3UnsupportedInput) .value("QSSCompilerError", qssc::ErrorCategory::QSSCompilerError) .value("QSSCompilerNoInputError", qssc::ErrorCategory::QSSCompilerNoInputError) diff --git a/releasenotes/notes/add-unsupported-openqasm3-input-a584bb990cd9c9ff.yaml b/releasenotes/notes/add-unsupported-openqasm3-input-a584bb990cd9c9ff.yaml new file mode 100644 index 000000000..23a48b3c1 --- /dev/null +++ b/releasenotes/notes/add-unsupported-openqasm3-input-a584bb990cd9c9ff.yaml @@ -0,0 +1,6 @@ +--- +features: + - | + A new diagnostic has been added for unsupported OpenQASM 3 semantics - ``OpenQASM3UnsupportedInput``. + This should be raised when the input OpenQASM 3 semantics are not valid for the compiler. +