guppylang
guppylang copied to clipboard
Caret offset in compile error message
The following code produces an error that has the carets offset by 1 space to the left:
from guppylang.decorator import guppy
from guppylang.std.angles import angle, pi
from guppylang.std.builtins import array, owned, py, comptime, result, owned
from guppylang.std.quantum import *
from guppylang import enable_experimental_features
from pathlib import Path
enable_experimental_features()
@guppy
def main_circuit() -> None:
qreg0 = array(qubit() for _ in range(3))
measure_array(qreg0)
discard_array(qreg0)
return
hugr = guppy.compile(main_circuit)
gives error:
11 | qreg0 = array(qubit() for _ in range(3))
12 | measure_array(qreg0)
13 | discard_array(qreg0)
| ^^^^^ Variable `qreg0` with non-copyable type `array[qubit, 3]`
| cannot be consumed ...
|
12 | measure_array(qreg0)
| ----- since it was already consumed here
Guppy compilation failed due to 1 previous error
where the caret under qreg0 is offset
The problem seems to be the tab indentation