guppylang-internals 0.26.0__py3-none-any.whl → 0.27.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
1
  # This is updated by our release-please workflow, triggered by this
2
2
  # annotation: x-release-please-version
3
- __version__ = "0.26.0"
3
+ __version__ = "0.27.0"
@@ -668,6 +668,9 @@ def is_comptime_expression(node: ast.AST) -> ComptimeExpr | None:
668
668
 
669
669
  Otherwise, returns `None`.
670
670
  """
671
+ if isinstance(node, ComptimeExpr):
672
+ return node
673
+
671
674
  if (
672
675
  isinstance(node, ast.Call)
673
676
  and isinstance(node.func, ast.Name)
@@ -33,7 +33,9 @@ class AlreadyUsedError(Error):
33
33
 
34
34
  @dataclass(frozen=True)
35
35
  class PrevUse(Note):
36
- span_label: ClassVar[str] = "since it was already {prev_kind.subjunctive} here"
36
+ span_label: ClassVar[str] = (
37
+ "{place.describe} already {prev_kind.subjunctive} here"
38
+ )
37
39
  prev_kind: UseKind
38
40
 
39
41
  @dataclass(frozen=True)
@@ -55,7 +57,9 @@ class ComprAlreadyUsedError(Error):
55
57
 
56
58
  @dataclass(frozen=True)
57
59
  class PrevUse(Note):
58
- span_label: ClassVar[str] = "since it was already {prev_kind.subjunctive} here"
60
+ span_label: ClassVar[str] = (
61
+ "{place.describe} already {prev_kind.subjunctive} here"
62
+ )
59
63
  prev_kind: UseKind
60
64
 
61
65
 
@@ -85,6 +85,7 @@ from guppylang_internals.checker.errors.type_errors import (
85
85
  WrongNumberOfArgsError,
86
86
  )
87
87
  from guppylang_internals.definition.common import Definition
88
+ from guppylang_internals.definition.parameter import ParamDef
88
89
  from guppylang_internals.definition.ty import TypeDef
89
90
  from guppylang_internals.definition.value import CallableDef, ValueDef
90
91
  from guppylang_internals.error import (
@@ -407,23 +408,27 @@ class ExprSynthesizer(AstVisitor[tuple[ast.expr, Type]]):
407
408
  raise GuppyError(IllegalConstant(node, type(node.value)))
408
409
  return node, ty
409
410
 
411
+ def _check_generic_param(self, name: str, node: ast.expr) -> tuple[ast.expr, Type]:
412
+ """Helper method to check a generic parameter (ConstParam or TypeParam)."""
413
+ param = self.ctx.generic_params[name]
414
+ match param:
415
+ case ConstParam() as param:
416
+ ast_node = with_loc(node, GenericParamValue(id=name, param=param))
417
+ return ast_node, param.ty
418
+ case TypeParam() as param:
419
+ raise GuppyError(
420
+ ExpectedError(node, "a value", got=f"type `{param.name}`")
421
+ )
422
+ case _:
423
+ return assert_never(param)
424
+
410
425
  def visit_Name(self, node: ast.Name) -> tuple[ast.expr, Type]:
411
426
  x = node.id
412
427
  if x in self.ctx.locals:
413
428
  var = self.ctx.locals[x]
414
429
  return with_loc(node, PlaceNode(place=var)), var.ty
415
430
  elif x in self.ctx.generic_params:
416
- param = self.ctx.generic_params[x]
417
- match param:
418
- case ConstParam() as param:
419
- ast_node = with_loc(node, GenericParamValue(id=x, param=param))
420
- return ast_node, param.ty
421
- case TypeParam() as param:
422
- raise GuppyError(
423
- ExpectedError(node, "a value", got=f"type `{param.name}`")
424
- )
425
- case _:
426
- return assert_never(param)
431
+ return self._check_generic_param(x, node)
427
432
  elif x in self.ctx.globals:
428
433
  match self.ctx.globals[x]:
429
434
  case Definition() as defn:
@@ -454,6 +459,16 @@ class ExprSynthesizer(AstVisitor[tuple[ast.expr, Type]]):
454
459
  defn, "__new__"
455
460
  ):
456
461
  return with_loc(node, GlobalName(id=name, def_id=constr.id)), constr.ty
462
+ # Handle parameter definitions (e.g., nat_var) that may be imported
463
+ case ParamDef():
464
+ # Check if this parameter is in our generic_params
465
+ # (e.g., used in type signature)
466
+ if name in self.ctx.generic_params:
467
+ return self._check_generic_param(name, node)
468
+ # If not in generic_params, it's being used outside its scope
469
+ raise GuppyError(
470
+ ExpectedError(node, "a value", got=f"{defn.description} `{name}`")
471
+ )
457
472
  case defn:
458
473
  raise GuppyError(
459
474
  ExpectedError(node, "a value", got=f"{defn.description} `{name}`")
@@ -325,14 +325,7 @@ class ExprCompiler(CompilerBase, AstVisitor[Wire]):
325
325
 
326
326
  def _pack_returns(self, returns: Sequence[Wire], return_ty: Type) -> Wire:
327
327
  """Groups function return values into a tuple"""
328
- if isinstance(return_ty, TupleType | NoneType) and not return_ty.preserve:
329
- types = type_to_row(return_ty)
330
- assert len(returns) == len(types)
331
- return self._pack_tuple(returns, types)
332
- assert (
333
- len(returns) == 1
334
- ), f"Expected a single return value. Got {returns}. return type {return_ty}"
335
- return returns[0]
328
+ return pack_returns(returns, return_ty, self.builder, self.ctx)
336
329
 
337
330
  def _update_inout_ports(
338
331
  self,
@@ -760,6 +753,35 @@ def expr_to_row(expr: ast.expr) -> list[ast.expr]:
760
753
  return expr.elts if isinstance(expr, ast.Tuple) else [expr]
761
754
 
762
755
 
756
+ def pack_returns(
757
+ returns: Sequence[Wire],
758
+ return_ty: Type,
759
+ builder: DfBase[ops.DfParentOp],
760
+ ctx: CompilerContext,
761
+ ) -> Wire:
762
+ """Groups function return values into a tuple"""
763
+ if isinstance(return_ty, TupleType | NoneType) and not return_ty.preserve:
764
+ types = type_to_row(return_ty)
765
+ assert len(returns) == len(types)
766
+ hugr_tys = [t.to_hugr(ctx) for t in types]
767
+ return builder.add_op(ops.MakeTuple(hugr_tys), *returns)
768
+ assert (
769
+ len(returns) == 1
770
+ ), f"Expected a single return value. Got {returns}. return type {return_ty}"
771
+ return returns[0]
772
+
773
+
774
+ def unpack_wire(
775
+ wire: Wire, return_ty: Type, builder: DfBase[ops.DfParentOp], ctx: CompilerContext
776
+ ) -> list[Wire]:
777
+ """The inverse of `pack_returns`"""
778
+ if isinstance(return_ty, TupleType | NoneType) and not return_ty.preserve:
779
+ types = type_to_row(return_ty)
780
+ hugr_tys = [t.to_hugr(ctx) for t in types]
781
+ return list(builder.add_op(ops.UnpackTuple(hugr_tys), wire).outputs())
782
+ return [wire]
783
+
784
+
763
785
  def instantiation_needs_unpacking(func_ty: FunctionType, inst: Inst) -> bool:
764
786
  """Checks if instantiating a polymorphic makes it return a row."""
765
787
  if isinstance(func_ty.output, BoundTypeVar):
@@ -8,7 +8,7 @@ from guppylang_internals.checker.modifier_checker import non_copyable_front_othe
8
8
  from guppylang_internals.compiler.cfg_compiler import compile_cfg
9
9
  from guppylang_internals.compiler.core import CompilerContext, DFContainer
10
10
  from guppylang_internals.compiler.expr_compiler import ExprCompiler
11
- from guppylang_internals.definition.function import add_unitarity_metadata
11
+ from guppylang_internals.definition.metadata import add_metadata
12
12
  from guppylang_internals.nodes import CheckedModifiedBlock, PlaceNode
13
13
  from guppylang_internals.std._internal.compiler.array import (
14
14
  array_new,
@@ -57,7 +57,10 @@ def compile_modified_block(
57
57
  func_builder = dfg.builder.module_root_builder().define_function(
58
58
  str(modified_block), hugr_ty.input, hugr_ty.output
59
59
  )
60
- add_unitarity_metadata(func_builder, modified_block.ty.unitary_flags)
60
+ add_metadata(
61
+ func_builder,
62
+ additional_metadata={"unitary": modified_block.ty.unitary_flags.value},
63
+ )
61
64
 
62
65
  # compile body
63
66
  cfg = compile_cfg(modified_block.cfg, func_builder, func_builder.inputs(), ctx)
@@ -26,7 +26,7 @@ from guppylang_internals.definition.ty import OpaqueTypeDef, TypeDef
26
26
  from guppylang_internals.definition.wasm import RawWasmFunctionDef
27
27
  from guppylang_internals.dummy_decorator import _dummy_custom_decorator, sphinx_running
28
28
  from guppylang_internals.engine import DEF_STORE
29
- from guppylang_internals.error import GuppyError
29
+ from guppylang_internals.error import GuppyError, pretty_errors
30
30
  from guppylang_internals.std._internal.checker import WasmCallChecker
31
31
  from guppylang_internals.std._internal.compiler.wasm import (
32
32
  WasmModuleCallCompiler,
@@ -207,6 +207,7 @@ def custom_type(
207
207
  return dec
208
208
 
209
209
 
210
+ @pretty_errors
210
211
  def wasm_module(
211
212
  filename: str,
212
213
  ) -> Callable[[builtins.type[T]], GuppyDefinition]:
@@ -252,6 +253,7 @@ def ext_module_decorator(
252
253
  def fun(
253
254
  filename: str, module: str | None
254
255
  ) -> Callable[[builtins.type[T]], GuppyDefinition]:
256
+ @pretty_errors
255
257
  def dec(cls: builtins.type[T]) -> GuppyDefinition:
256
258
  # N.B. Only one module per file and vice-versa
257
259
  ext_module = type_def(
@@ -33,6 +33,7 @@ from guppylang_internals.definition.common import (
33
33
  ParsableDef,
34
34
  UnknownSourceError,
35
35
  )
36
+ from guppylang_internals.definition.metadata import GuppyMetadata, add_metadata
36
37
  from guppylang_internals.definition.value import (
37
38
  CallableDef,
38
39
  CallReturnWires,
@@ -72,13 +73,22 @@ class RawFunctionDef(ParsableDef):
72
73
 
73
74
  unitary_flags: UnitaryFlags = field(default=UnitaryFlags.NoFlags, kw_only=True)
74
75
 
76
+ metadata: GuppyMetadata | None = field(default=None, kw_only=True)
77
+
75
78
  def parse(self, globals: Globals, sources: SourceMap) -> "ParsedFunctionDef":
76
79
  """Parses and checks the user-provided signature of the function."""
77
80
  func_ast, docstring = parse_py_func(self.python_func, sources)
78
81
  ty = check_signature(
79
82
  func_ast, globals, self.id, unitary_flags=self.unitary_flags
80
83
  )
81
- return ParsedFunctionDef(self.id, self.name, func_ast, ty, docstring)
84
+ return ParsedFunctionDef(
85
+ self.id,
86
+ self.name,
87
+ func_ast,
88
+ ty,
89
+ docstring,
90
+ metadata=self.metadata,
91
+ )
82
92
 
83
93
 
84
94
  @dataclass(frozen=True)
@@ -103,6 +113,8 @@ class ParsedFunctionDef(CheckableDef, CallableDef):
103
113
 
104
114
  description: str = field(default="function", init=False)
105
115
 
116
+ metadata: GuppyMetadata | None = field(default=None, kw_only=True)
117
+
106
118
  def check(self, globals: Globals) -> "CheckedFunctionDef":
107
119
  """Type checks the body of the function."""
108
120
  # Add python variable scope to the globals
@@ -114,6 +126,7 @@ class ParsedFunctionDef(CheckableDef, CallableDef):
114
126
  self.ty,
115
127
  self.docstring,
116
128
  cfg,
129
+ metadata=self.metadata,
117
130
  )
118
131
 
119
132
  def check_call(
@@ -177,7 +190,11 @@ class CheckedFunctionDef(ParsedFunctionDef, MonomorphizableDef):
177
190
  func_def = module.module_root_builder().define_function(
178
191
  self.name, hugr_ty.body.input, hugr_ty.body.output, hugr_ty.params
179
192
  )
180
- add_unitarity_metadata(func_def, self.ty.unitary_flags)
193
+ add_metadata(
194
+ func_def,
195
+ self.metadata,
196
+ additional_metadata={"unitary": self.ty.unitary_flags.value},
197
+ )
181
198
  return CompiledFunctionDef(
182
199
  self.id,
183
200
  self.name,
@@ -187,6 +204,7 @@ class CheckedFunctionDef(ParsedFunctionDef, MonomorphizableDef):
187
204
  self.docstring,
188
205
  self.cfg,
189
206
  func_def,
207
+ metadata=self.metadata,
190
208
  )
191
209
 
192
210
 
@@ -305,8 +323,3 @@ def parse_source(source_lines: list[str], line_offset: int) -> tuple[str, ast.AS
305
323
  else:
306
324
  node = ast.parse(source).body[0]
307
325
  return source, node, line_offset
308
-
309
-
310
- def add_unitarity_metadata(func: hf.Function, flags: UnitaryFlags) -> None:
311
- """Stores unitarity annotations in the metadate of a Hugr function definition."""
312
- func.metadata["unitary"] = flags.value
@@ -0,0 +1,87 @@
1
+ """Metadata attached to objects within the Guppy compiler, both for internal use and to
2
+ attach to HUGR nodes for lower-level processing."""
3
+
4
+ from abc import ABC
5
+ from dataclasses import dataclass, field, fields
6
+ from typing import Any, ClassVar, Generic, TypeVar
7
+
8
+ from hugr.hugr.node_port import ToNode
9
+
10
+ from guppylang_internals.diagnostic import Fatal
11
+ from guppylang_internals.error import GuppyError
12
+
13
+ T = TypeVar("T")
14
+
15
+
16
+ @dataclass(init=True, kw_only=True)
17
+ class GuppyMetadataValue(ABC, Generic[T]):
18
+ """A template class for a metadata value within the scope of the Guppy compiler.
19
+ Implementations should provide the `key` in reverse-URL format."""
20
+
21
+ key: ClassVar[str]
22
+ value: T | None = None
23
+
24
+
25
+ class MetadataMaxQubits(GuppyMetadataValue[int]):
26
+ key = "tket.hint.max_qubits"
27
+
28
+
29
+ @dataclass(frozen=True, init=True, kw_only=True)
30
+ class GuppyMetadata:
31
+ """DTO for metadata within the scope of the guppy compiler for attachment to HUGR
32
+ nodes. See `add_metadata`."""
33
+
34
+ max_qubits: MetadataMaxQubits = field(default_factory=MetadataMaxQubits, init=False)
35
+
36
+ @classmethod
37
+ def reserved_keys(cls) -> set[str]:
38
+ return {f.type.key for f in fields(GuppyMetadata)}
39
+
40
+
41
+ @dataclass(frozen=True)
42
+ class MetadataAlreadySetError(Fatal):
43
+ title: ClassVar[str] = "Metadata key already set"
44
+ message: ClassVar[str] = "Received two values for the metadata key `{key}`"
45
+ key: str
46
+
47
+
48
+ @dataclass(frozen=True)
49
+ class ReservedMetadataKeysError(Fatal):
50
+ title: ClassVar[str] = "Metadata key is reserved"
51
+ message: ClassVar[str] = (
52
+ "The following metadata keys are reserved by Guppy but also provided in "
53
+ "additional metadata: `{keys}`"
54
+ )
55
+ keys: set[str]
56
+
57
+
58
+ def add_metadata(
59
+ node: ToNode,
60
+ metadata: GuppyMetadata | None = None,
61
+ *,
62
+ additional_metadata: dict[str, Any] | None = None,
63
+ ) -> None:
64
+ """Adds metadata to the given node using the keys defined through inheritors of
65
+ `GuppyMetadataValue` defined in the `GuppyMetadata` class.
66
+
67
+ Additional metadata is forwarded as is, although the given dictionary may not
68
+ contain any keys already reserved by fields in `GuppyMetadata`.
69
+ """
70
+ if metadata is not None:
71
+ for f in fields(GuppyMetadata):
72
+ data: GuppyMetadataValue[Any] = getattr(metadata, f.name)
73
+ if data.key in node.metadata:
74
+ raise GuppyError(MetadataAlreadySetError(None, data.key))
75
+ if data.value is not None:
76
+ node.metadata[data.key] = data.value
77
+
78
+ if additional_metadata is not None:
79
+ reserved_keys = GuppyMetadata.reserved_keys()
80
+ used_reserved_keys = reserved_keys.intersection(additional_metadata.keys())
81
+ if len(used_reserved_keys) > 0:
82
+ raise GuppyError(ReservedMetadataKeysError(None, keys=used_reserved_keys))
83
+
84
+ for key, value in additional_metadata.items():
85
+ if key in node.metadata:
86
+ raise GuppyError(MetadataAlreadySetError(None, key))
87
+ node.metadata[key] = value
@@ -1,4 +1,5 @@
1
1
  import ast
2
+ import copy
2
3
  from contextlib import suppress
3
4
  from dataclasses import dataclass, field
4
5
  from typing import ClassVar, NoReturn
@@ -86,7 +87,11 @@ class OverloadedFunctionDef(CompiledCallableDef, CallableDef):
86
87
  assert isinstance(defn, CallableDef)
87
88
  available_sigs.append(defn.ty)
88
89
  with suppress(GuppyError):
89
- return defn.check_call(args, ty, node, ctx)
90
+ # check_call may modify args and node,
91
+ # thus we deepcopy them before passing in the function
92
+ node_copy = copy.deepcopy(node)
93
+ args_copy = copy.deepcopy(args)
94
+ return defn.check_call(args_copy, ty, node_copy, ctx)
90
95
  return self._call_error(args, node, ctx, available_sigs, ty)
91
96
 
92
97
  def synthesize_call(
@@ -98,7 +103,11 @@ class OverloadedFunctionDef(CompiledCallableDef, CallableDef):
98
103
  assert isinstance(defn, CallableDef)
99
104
  available_sigs.append(defn.ty)
100
105
  with suppress(GuppyError):
101
- return defn.synthesize_call(args, node, ctx)
106
+ # synthesize_call may modify args and node,
107
+ # thus we deepcopy them before passing in the function
108
+ node_copy = copy.deepcopy(node)
109
+ args_copy = copy.deepcopy(args)
110
+ return defn.synthesize_call(args_copy, node_copy, ctx)
102
111
  return self._call_error(args, node, ctx, available_sigs)
103
112
 
104
113
  def _call_error(
@@ -46,6 +46,7 @@ from guppylang_internals.std._internal.compiler.array import (
46
46
  array_new,
47
47
  array_unpack,
48
48
  )
49
+ from guppylang_internals.std._internal.compiler.quantum import from_halfturns_unchecked
49
50
  from guppylang_internals.std._internal.compiler.tket_bool import OpaqueBool, make_opaque
50
51
  from guppylang_internals.tys.builtin import array_type, bool_type, float_type
51
52
  from guppylang_internals.tys.subst import Inst, Subst
@@ -235,12 +236,15 @@ class ParsedPytketDef(CallableDef, CompilableDef):
235
236
  lex_names = sorted(param_order)
236
237
  name_to_param = dict(zip(lex_names, lex_params, strict=True))
237
238
  angle_wires = [name_to_param[name] for name in param_order]
238
- # Need to convert all angles to floats.
239
+ # Need to convert all angles to rotations.
239
240
  for angle in angle_wires:
240
241
  [halfturns] = outer_func.add_op(
241
242
  ops.UnpackTuple([FLOAT_T]), angle
242
243
  )
243
- param_wires.append(halfturns)
244
+ rotation = outer_func.add_op(
245
+ from_halfturns_unchecked(), halfturns
246
+ )
247
+ param_wires.append(rotation)
244
248
 
245
249
  # Pass all arguments to call node.
246
250
  call_node = outer_func.call(
@@ -208,7 +208,8 @@ class DiagnosticsRenderer:
208
208
  MAX_MESSAGE_LINE_LEN: Final[int] = 80
209
209
 
210
210
  #: Number of preceding source lines we show to give additional context
211
- PREFIX_CONTEXT_LINES: Final[int] = 2
211
+ PREFIX_ERROR_CONTEXT_LINES: Final[int] = 2
212
+ PREFIX_NOTE_CONTEXT_LINES: Final[int] = 1
212
213
 
213
214
  def __init__(self, source: SourceMap) -> None:
214
215
  self.buffer = []
@@ -243,31 +244,84 @@ class DiagnosticsRenderer:
243
244
  else:
244
245
  span = to_span(diag.span)
245
246
  level = self.level_str(diag.level)
246
- all_spans = [span] + [
247
- to_span(child.span) for child in diag.children if child.span
247
+
248
+ children_with_span = [
249
+ (child, to_span(child.span)) for child in diag.children if child.span
248
250
  ]
251
+ all_spans = [span] + [span for _, span in children_with_span]
249
252
  max_lineno = max(s.end.line for s in all_spans)
253
+
250
254
  self.buffer.append(f"{level}: {diag.rendered_title} (at {span.start})")
255
+
256
+ # Render main error span first
251
257
  self.render_snippet(
252
258
  span,
253
259
  diag.rendered_span_label,
254
260
  max_lineno,
255
261
  is_primary=True,
256
- prefix_lines=self.PREFIX_CONTEXT_LINES,
262
+ prefix_lines=self.PREFIX_ERROR_CONTEXT_LINES,
257
263
  )
258
- # First render all sub-diagnostics that come with a span
259
- for sub_diag in diag.children:
260
- if sub_diag.span:
264
+
265
+ match children_with_span:
266
+ case []:
267
+ pass
268
+ case [(only_child, span)]:
269
+ self.buffer.append("\nNote:")
261
270
  self.render_snippet(
262
- to_span(sub_diag.span),
263
- sub_diag.rendered_span_label,
271
+ span,
272
+ only_child.rendered_span_label,
264
273
  max_lineno,
265
- is_primary=False,
274
+ prefix_lines=self.PREFIX_NOTE_CONTEXT_LINES,
275
+ print_pad_line=True,
266
276
  )
277
+ case [(first_child, first_span), *children_with_span]:
278
+ self.buffer.append("\nNotes:")
279
+ self.render_snippet(
280
+ first_span,
281
+ first_child.rendered_span_label,
282
+ max_lineno,
283
+ prefix_lines=self.PREFIX_NOTE_CONTEXT_LINES,
284
+ print_pad_line=True,
285
+ )
286
+
287
+ prev_span_end_lineno = first_span.end.line
288
+
289
+ for sub_diag, span in children_with_span:
290
+ span_start_lineno = span.start.line
291
+ span_end_lineno = span.end.line
292
+
293
+ # If notes are on the same line, render them together
294
+ if span_start_lineno == prev_span_end_lineno:
295
+ prefix_lines = 0
296
+ print_pad_line = True
297
+ # if notes are close enough, render them adjacently
298
+ elif (
299
+ span_start_lineno - self.PREFIX_NOTE_CONTEXT_LINES
300
+ <= prev_span_end_lineno + 1
301
+ ):
302
+ prefix_lines = span_start_lineno - prev_span_end_lineno - 1
303
+ print_pad_line = False
304
+ # otherwise we render a separator between notes
305
+ else:
306
+ self.buffer.append("")
307
+ prefix_lines = self.PREFIX_NOTE_CONTEXT_LINES
308
+ print_pad_line = False
309
+
310
+ self.render_snippet(
311
+ span,
312
+ sub_diag.rendered_span_label,
313
+ max_lineno,
314
+ prefix_lines=prefix_lines,
315
+ print_pad_line=print_pad_line,
316
+ )
317
+ prev_span_end_lineno = span_end_lineno
318
+
319
+ # Render the main diagnostic message if present
267
320
  if diag.rendered_message:
268
321
  self.buffer.append("")
269
322
  self.buffer += wrap(diag.rendered_message, self.MAX_MESSAGE_LINE_LEN)
270
- # Finally, render all sub-diagnostics that have a non-span message
323
+
324
+ # Render all sub-diagnostics that have a non-span message
271
325
  for sub_diag in diag.children:
272
326
  if sub_diag.rendered_message:
273
327
  self.buffer.append("")
@@ -281,8 +335,9 @@ class DiagnosticsRenderer:
281
335
  span: Span,
282
336
  label: str | None,
283
337
  max_lineno: int,
284
- is_primary: bool,
338
+ is_primary: bool = False,
285
339
  prefix_lines: int = 0,
340
+ print_pad_line: bool = False,
286
341
  ) -> None:
287
342
  """Renders the source associated with a span together with an optional label.
288
343
 
@@ -315,7 +370,8 @@ class DiagnosticsRenderer:
315
370
  Optionally includes up to `prefix_lines` preceding source lines to give
316
371
  additional context.
317
372
  """
318
- # Check how much space we need to reserve for the leading line numbers
373
+ # Check how much horizontal space we need to reserve for the leading
374
+ # line numbers
319
375
  ll_length = len(str(max_lineno))
320
376
  highlight_char = "^" if is_primary else "-"
321
377
 
@@ -324,8 +380,9 @@ class DiagnosticsRenderer:
324
380
  ll = "" if line_number is None else str(line_number)
325
381
  self.buffer.append(" " * (ll_length - len(ll)) + ll + " | " + line)
326
382
 
327
- # One line of padding
328
- render_line("")
383
+ # One line of padding (primary span, first note or between same line notes)
384
+ if is_primary or print_pad_line:
385
+ render_line("")
329
386
 
330
387
  # Grab all lines we want to display and remove excessive leading whitespace
331
388
  prefix_lines = min(prefix_lines, span.start.line - 1)
@@ -220,21 +220,12 @@ class CompilationEngine:
220
220
 
221
221
  This is the main driver behind `guppy.check()`.
222
222
  """
223
- from guppylang_internals.checker.core import Globals
224
-
225
223
  # Clear previous compilation cache.
226
224
  # TODO: In order to maintain results from the previous `check` call we would
227
225
  # need to store and check if any dependencies have changed.
228
226
  self.reset()
229
227
 
230
- defn = DEF_STORE.raw_defs[id]
231
- self.to_check_worklist = {
232
- defn.id: (
233
- defn.parse(Globals(DEF_STORE.frames[defn.id]), DEF_STORE.sources)
234
- if isinstance(defn, ParsableDef)
235
- else defn
236
- )
237
- }
228
+ self.to_check_worklist[id] = self.get_parsed(id)
238
229
  while self.types_to_check_worklist or self.to_check_worklist:
239
230
  # Types need to be checked first. This is because parsing e.g. a function
240
231
  # definition requires instantiating the types in its signature which can
@@ -172,6 +172,14 @@ class MakeIter(ast.expr):
172
172
  self.origin_node = origin_node
173
173
  self.unwrap_size_hint = unwrap_size_hint
174
174
 
175
+ # Needed for the deepcopy to work correctly, ast.AST's deepcopy logic
176
+ # reconstructs nodes using _fields only.
177
+ # If you store extra attributes or rely overwriting the __init__,
178
+ # deepcopy will crash with a constructor mismatch.
179
+ # Overriding __reduce__ forces deepcopy to copy the instance dictionary instead
180
+ __reduce_ex__ = object.__reduce_ex__
181
+ __reduce__ = object.__reduce__
182
+
175
183
 
176
184
  class IterNext(ast.expr):
177
185
  """Obtains the next element of an iterator using the `__next__` magic method.
@@ -349,6 +357,10 @@ class ArrayUnpack(ast.expr):
349
357
  self.length = length
350
358
  self.elt_type = elt_type
351
359
 
360
+ # See MakeIter for explanation
361
+ __reduce__ = object.__reduce__
362
+ __reduce_ex__ = object.__reduce_ex__
363
+
352
364
 
353
365
  class IterableUnpack(ast.expr):
354
366
  """The LHS of an unpacking assignment of an iterable type."""
@@ -373,6 +385,10 @@ class IterableUnpack(ast.expr):
373
385
  self.compr = compr
374
386
  self.rhs_var = rhs_var
375
387
 
388
+ # See MakeIter for explanation
389
+ __reduce__ = object.__reduce__
390
+ __reduce_ex__ = object.__reduce_ex__
391
+
376
392
 
377
393
  #: Any unpacking operation.
378
394
  AnyUnpack = TupleUnpack | ArrayUnpack | IterableUnpack
@@ -420,6 +436,10 @@ class Dagger(ast.expr):
420
436
  def __init__(self, node: ast.expr) -> None:
421
437
  super().__init__(**node.__dict__)
422
438
 
439
+ # See MakeIter for explanation
440
+ __reduce__ = object.__reduce__
441
+ __reduce_ex__ = object.__reduce_ex__
442
+
423
443
 
424
444
  class Control(ast.Call):
425
445
  """The control modifier"""
@@ -434,6 +454,10 @@ class Control(ast.Call):
434
454
  self.ctrl = ctrl
435
455
  self.qubit_num = None
436
456
 
457
+ # See MakeIter for explanation
458
+ __reduce__ = object.__reduce__
459
+ __reduce_ex__ = object.__reduce_ex__
460
+
437
461
 
438
462
  class Power(ast.expr):
439
463
  """The power modifier"""
@@ -446,6 +470,10 @@ class Power(ast.expr):
446
470
  super().__init__(**node.__dict__)
447
471
  self.iter = iter
448
472
 
473
+ # See MakeIter for explanation
474
+ __reduce__ = object.__reduce__
475
+ __reduce_ex__ = object.__reduce_ex__
476
+
449
477
 
450
478
  Modifier = Dagger | Control | Power
451
479
 
@@ -533,6 +561,10 @@ class CheckedModifiedBlock(ast.With):
533
561
  self.control = control
534
562
  self.power = power
535
563
 
564
+ # See MakeIter for explanation
565
+ __reduce__ = object.__reduce__
566
+ __reduce_ex__ = object.__reduce_ex__
567
+
536
568
  def __str__(self) -> str:
537
569
  # generate a function name from the def_id
538
570
  return f"__WithBlock__({self.def_id})"
@@ -16,6 +16,7 @@ from guppylang_internals.std._internal.compiler.arithmetic import convert_itousi
16
16
  from guppylang_internals.std._internal.compiler.prelude import (
17
17
  build_unwrap_right,
18
18
  )
19
+ from guppylang_internals.std._internal.compiler.tket_bool import make_opaque
19
20
  from guppylang_internals.tys.arg import ConstArg, TypeArg
20
21
 
21
22
  if TYPE_CHECKING:
@@ -206,6 +207,14 @@ def barray_new_all_borrowed(elem_ty: ht.Type, length: ht.TypeArg) -> ops.ExtOp:
206
207
  return _instantiate_array_op("new_all_borrowed", elem_ty, length, [], [arr_ty])
207
208
 
208
209
 
210
+ def barray_is_borrowed(elem_ty: ht.Type, length: ht.TypeArg) -> ops.ExtOp:
211
+ """Returns an array `is_borrowed` operation."""
212
+ arr_ty = array_type(elem_ty, length)
213
+ return _instantiate_array_op(
214
+ "is_borrowed", elem_ty, length, [arr_ty, ht.USize()], [arr_ty, ht.Bool]
215
+ )
216
+
217
+
209
218
  def array_clone(elem_ty: ht.Type, length: ht.TypeArg) -> ops.ExtOp:
210
219
  """Returns an array `clone` operation for arrays none of whose elements are
211
220
  borrowed."""
@@ -320,7 +329,15 @@ class ArrayGetitemCompiler(ArrayCompiler):
320
329
 
321
330
 
322
331
  class ArraySetitemCompiler(ArrayCompiler):
323
- """Compiler for the `array.__setitem__` function."""
332
+ """Compiler for the `array.__setitem__` function.
333
+
334
+ Arguments:
335
+ elem_first: If `True`, then compiler will assume that the element wire comes
336
+ before the index wire. Defaults to `False`.
337
+ """
338
+
339
+ def __init__(self, elem_first: bool = False):
340
+ self.elem_first = elem_first
324
341
 
325
342
  def _build_classical_setitem(
326
343
  self, array: Wire, idx: Wire, elem: Wire
@@ -359,6 +376,8 @@ class ArraySetitemCompiler(ArrayCompiler):
359
376
 
360
377
  def compile_with_inouts(self, args: list[Wire]) -> CallReturnWires:
361
378
  [array, idx, elem] = args
379
+ if self.elem_first:
380
+ elem, idx = idx, elem
362
381
  if self.elem_ty.type_bound() == ht.TypeBound.Linear:
363
382
  return self._build_linear_setitem(array, idx, elem)
364
383
  else:
@@ -379,3 +398,19 @@ class ArrayDiscardAllUsedCompiler(ArrayCompiler):
379
398
  arr,
380
399
  )
381
400
  return []
401
+
402
+
403
+ class ArrayIsBorrowedCompiler(ArrayCompiler):
404
+ """Compiler for the `array.is_borrowed` method."""
405
+
406
+ def compile_with_inouts(self, args: list[Wire]) -> CallReturnWires:
407
+ [array, idx] = args
408
+ idx = self.builder.add_op(convert_itousize(), idx)
409
+ array, b = self.builder.add_op(
410
+ barray_is_borrowed(self.elem_ty, self.length), array, idx
411
+ )
412
+ b = self.builder.add_op(make_opaque(), b)
413
+ return CallReturnWires(regular_returns=[b], inout_returns=[array])
414
+
415
+ def compile(self, args: list[Wire]) -> list[Wire]:
416
+ raise InternalGuppyError("Call compile_with_inouts instead")
@@ -4,6 +4,8 @@ from collections.abc import Sequence
4
4
  from hugr import Wire, ops
5
5
  from hugr import tys as ht
6
6
 
7
+ from guppylang_internals.ast_util import get_type
8
+ from guppylang_internals.compiler.expr_compiler import pack_returns, unpack_wire
7
9
  from guppylang_internals.definition.custom import (
8
10
  CustomCallCompiler,
9
11
  CustomInoutCallCompiler,
@@ -69,7 +71,14 @@ class EitherConstructor(EitherCompiler, CustomCallCompiler):
69
71
  # In the `right` case, the type args are swapped around since `R` occurs
70
72
  # first in the signature :(
71
73
  ty.variant_rows = [ty.variant_rows[1], ty.variant_rows[0]]
72
- return [self.builder.add_op(ops.Tag(self.tag, ty), *args)]
74
+ # For the same reason, the type of the input corresponds to the first type
75
+ # variable
76
+ inp_arg = self.type_args[0]
77
+ assert isinstance(inp_arg, TypeArg)
78
+ [inp] = args
79
+ # Unpack the single input into a row
80
+ inp_row = unpack_wire(inp, inp_arg.ty, self.builder, self.ctx)
81
+ return [self.builder.add_op(ops.Tag(self.tag, ty), *inp_row)]
73
82
 
74
83
 
75
84
  class EitherTestCompiler(EitherCompiler):
@@ -128,4 +137,7 @@ class EitherUnwrapCompiler(EitherCompiler, CustomCallCompiler):
128
137
  out = build_unwrap_right(
129
138
  self.builder, either, "Either.unwrap_right: value is `left`"
130
139
  )
131
- return list(out)
140
+ # Pack outputs into a single wire. We're not allowed to return a row since the
141
+ # signature has a generic return type (also see `TupleType.preserve`)
142
+ return_ty = get_type(self.node)
143
+ return [pack_returns(list(out), return_ty, self.builder, self.ctx)]
@@ -40,12 +40,7 @@ class OpaqueBoolVal(hv.ExtensionValue):
40
40
  def to_value(self) -> hv.Extension:
41
41
  name = "ConstBool"
42
42
  payload = self.v
43
- return hv.Extension(
44
- name,
45
- typ=OpaqueBool,
46
- val=payload,
47
- extensions=[BOOL_EXTENSION.name],
48
- )
43
+ return hv.Extension(name, typ=OpaqueBool, val=payload)
49
44
 
50
45
  def __str__(self) -> str:
51
46
  return f"{self.v}"
@@ -59,7 +59,7 @@ class ConstWasmModule(val.ExtensionValue):
59
59
 
60
60
  name = "ConstWasmModule"
61
61
  payload = {"module_filename": self.wasm_file}
62
- return val.Extension(name, typ=ty, val=payload, extensions=["tket.wasm"])
62
+ return val.Extension(name, typ=ty, val=payload)
63
63
 
64
64
  def __str__(self) -> str:
65
65
  return f"tket.wasm.module(module_filename={self.wasm_file})"
@@ -342,6 +342,10 @@ class GuppyObject(DunderMixin):
342
342
  if not ty.droppable and not self._used:
343
343
  state.unused_undroppable_objs[self._id] = self
344
344
 
345
+ def __deepcopy__(self, memo: dict[int, Any]) -> "GuppyObject":
346
+ # Dummy deepcopy implementation, we do not want to actually deepcopy
347
+ return self
348
+
345
349
  @hide_trace
346
350
  def __getattr__(self, key: str) -> Any: # type: ignore[misc]
347
351
  # Guppy objects don't have fields (structs are treated separately below), so the
@@ -27,7 +27,7 @@ class ConcreteWasmModule:
27
27
  class WasmSignatureError(Error):
28
28
  title: ClassVar[str] = (
29
29
  "Invalid signature for @wasm function `{fn_name}`\n"
30
- "in wasm file: `{filename}`"
30
+ "in wasm file:\n`{filename}`"
31
31
  )
32
32
  fn_name: str
33
33
  filename: str
@@ -53,7 +53,7 @@ class WasmFunctionNotInFile(Error):
53
53
 
54
54
  @dataclass(frozen=True)
55
55
  class WasmFileNote(Note):
56
- message: ClassVar[str] = "Wasm file: {filename}"
56
+ message: ClassVar[str] = "Wasm file:\n`{filename}`"
57
57
  filename: str
58
58
 
59
59
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: guppylang-internals
3
- Version: 0.26.0
3
+ Version: 0.27.0
4
4
  Summary: Compiler internals for `guppylang` package.
5
5
  Author-email: Mark Koch <mark.koch@quantinuum.com>, TKET development team <tket-support@quantinuum.com>
6
6
  Maintainer-email: Mark Koch <mark.koch@quantinuum.com>, TKET development team <tket-support@quantinuum.com>
@@ -219,7 +219,7 @@ Classifier: Programming Language :: Python :: 3.13
219
219
  Classifier: Programming Language :: Python :: 3.14
220
220
  Classifier: Topic :: Software Development :: Compilers
221
221
  Requires-Python: <4,>=3.10
222
- Requires-Dist: hugr~=0.14.1
222
+ Requires-Dist: hugr~=0.15.0
223
223
  Requires-Dist: tket-exts~=0.12.0
224
224
  Requires-Dist: typing-extensions<5,>=4.9.0
225
225
  Requires-Dist: wasmtime~=v38.0.0
@@ -1,25 +1,25 @@
1
- guppylang_internals/__init__.py,sha256=eRNAncl2ENPaWe98y6nNX-U9UtENwgo-yfbWQkZy8Cs,130
1
+ guppylang_internals/__init__.py,sha256=Rr1m2rOvA7MWtjzXW08455-A3GfSprCoMF0CAXJT3ns,130
2
2
  guppylang_internals/ast_util.py,sha256=WHa7axpGrdsjzQk3iw3reDzYlcmsx0HsNH4Qbqwjjig,12531
3
- guppylang_internals/decorator.py,sha256=i0PV3XzWBFjBUBSGfq7d4KmQuEwvM3bAsatcTXVZq98,14112
4
- guppylang_internals/diagnostic.py,sha256=VCpIhyVD8KPtk0GDYMa8XH0lKVsRbsWNu_ucE2jQT2I,18395
3
+ guppylang_internals/decorator.py,sha256=msdwJjO_xP31qi6Qfsaa4O2ZEuc1ECBcIu_I4TzyGpA,14165
4
+ guppylang_internals/diagnostic.py,sha256=YbfQxuhpvRVnFNJr8PT_ZtCtN1vLW0rFIazUZftmX_U,20875
5
5
  guppylang_internals/dummy_decorator.py,sha256=LXTXrdcrr55YzerX3qrHS23q6S9pVdpUAvhprWzKH6E,2330
6
- guppylang_internals/engine.py,sha256=Npp02xXTb6bFYmHw52LVsVCAUi6dT3qaItEmpCB_2uA,10889
6
+ guppylang_internals/engine.py,sha256=H9wb8KvVyc14GtuPg-U6u1r97w0ezEGNe7VOgJ-EKKg,10607
7
7
  guppylang_internals/error.py,sha256=fjHsbglnH9GtcsLF4sSry7FTjrLoiyQ-L1JS3uGirx0,3393
8
8
  guppylang_internals/experimental.py,sha256=yERQgpT7P-x0-nr4gU4PdUCntByQwF2I9rfjpWtgqn4,3115
9
9
  guppylang_internals/ipython_inspect.py,sha256=rY2DpSpSBrRk0IZmuoz7jh35kGZHQnHLAQQFdb_-WnI,931
10
- guppylang_internals/nodes.py,sha256=wnnAI3sHZ-OwolcZMKYA_dkmz4IE5Y4CFqXDJ0LXAJM,12824
10
+ guppylang_internals/nodes.py,sha256=rKSEdEgDIFxj2sr1iQqSTOpNElyWvjs_uaeScY3irDY,13901
11
11
  guppylang_internals/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
12
  guppylang_internals/span.py,sha256=8rWzAAipWunhhyCp44qdUAPmOfAXkEMvicK0PYc3tTg,4986
13
- guppylang_internals/wasm_util.py,sha256=TyTS9pbFlqpcjCnRwCdCQliGhUWVHkUcZswAytI8oNc,3590
13
+ guppylang_internals/wasm_util.py,sha256=X6a4pZcmMA019Y-FteoSnywpBuBOcZ0wjHy4F8JnS-w,3594
14
14
  guppylang_internals/cfg/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
15
  guppylang_internals/cfg/analysis.py,sha256=fD3cY0bZ85iNWcmLAXFaXwcdCfB7gzssKjYfsm1J-wQ,8365
16
16
  guppylang_internals/cfg/bb.py,sha256=TxV5yHRqiH86lvLR0g4EZ4fs7S6Axoof1l0TIAZArJM,8591
17
- guppylang_internals/cfg/builder.py,sha256=QqzleSd5-3h77Uy-ng_lNJz73C6-eGwgG_6my8Dh2pQ,28252
17
+ guppylang_internals/cfg/builder.py,sha256=peBarfUK2g2GDtuKOx9dnEFzpZp2LbqUH-gZtNxvJbI,28312
18
18
  guppylang_internals/cfg/cfg.py,sha256=qQuWGK1rgPIkMyJFsX3LrqnXp3ptDDOuXwTbgf_NUSE,4489
19
19
  guppylang_internals/checker/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
20
  guppylang_internals/checker/cfg_checker.py,sha256=0hDxw2CTbTbjewtDjaoBehgon17tJaQG9YPO_qR6P0Q,13667
21
21
  guppylang_internals/checker/core.py,sha256=IPgnaRih5flDevzJsu6o_ycG3vk2X9Mt4A-MZ7gufNU,18163
22
- guppylang_internals/checker/expr_checker.py,sha256=cQVigPN-BE-0nfo_8EUSxCgzSFFfRTxA3dvEMZzzGA8,60121
22
+ guppylang_internals/checker/expr_checker.py,sha256=a07sqXQvT1G2CbTuuwb8t7l7n7eCpJSLHiFXXdM-Wpg,60931
23
23
  guppylang_internals/checker/func_checker.py,sha256=WxQtwQdYOfvPVHRem__LoBMax5eUzvmqEJXbxmHzG5M,16118
24
24
  guppylang_internals/checker/linearity_checker.py,sha256=cVgoUshu6YPEJ2mgk3RUWx38qt52WNMxjyLVV5eqgD4,37160
25
25
  guppylang_internals/checker/modifier_checker.py,sha256=ruhEkbT4g9YIJXOGRsfpdzUsbXxEbS95PC1LG-EAl3o,4175
@@ -28,16 +28,16 @@ guppylang_internals/checker/unitary_checker.py,sha256=TVUT4JskaOzNVLcMrQwOd5t5MB
28
28
  guppylang_internals/checker/errors/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
29
29
  guppylang_internals/checker/errors/comptime_errors.py,sha256=ee42lnVjXbjqirjp6vYaRvbKKexeNV08px1Kqu9eXn8,3436
30
30
  guppylang_internals/checker/errors/generic.py,sha256=r-BiSrmJh9jfXlxE029GMQ8yj30_qOTW2RAQsd3HYzs,2050
31
- guppylang_internals/checker/errors/linearity.py,sha256=VLGvwzfW6uljNjYUEIxNkgt6s3q9-yo1O22BoTiS4Xs,8922
31
+ guppylang_internals/checker/errors/linearity.py,sha256=jKp_IExMySGYjxEw-VbvVNgUewW6jRieseMLB4-twPA,8978
32
32
  guppylang_internals/checker/errors/type_errors.py,sha256=KUmcpN3tGLI_8BogcGKfV_N5BO7yqEBPgyHmf8hk-3M,10619
33
33
  guppylang_internals/checker/errors/wasm.py,sha256=TlwQRtlA0zpu8xwkBHWPYc25OIb6NrMHRxuYUfyD0Rg,956
34
34
  guppylang_internals/compiler/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
35
35
  guppylang_internals/compiler/cfg_compiler.py,sha256=dKAh2dWMUCXHpb5GjRzgT6Npnv74Vx5WqMaaa_X1koI,9004
36
36
  guppylang_internals/compiler/core.py,sha256=iWD2K4Ztu1nvK6o5ZIyR_c3UBc4cjBxfgzrZEJuOdfY,31548
37
- guppylang_internals/compiler/expr_compiler.py,sha256=ZlOP4JnvggjXC3uf0km-nRzk04IbblEdEJLeZpIWFDI,37198
37
+ guppylang_internals/compiler/expr_compiler.py,sha256=piZ4W3TxbQ5jR5BIAf6na2oaOlZSGeprCyere-mpwMM,37932
38
38
  guppylang_internals/compiler/func_compiler.py,sha256=0bo28RNsFZDYmllle-yFUXKC0UJsLl2TVjr3gvDMJVA,3377
39
39
  guppylang_internals/compiler/hugr_extension.py,sha256=eFUcxzBZoVzXV-AqEOJlh_rJkyuS3vFv1WKGOHjloJs,7966
40
- guppylang_internals/compiler/modifier_compiler.py,sha256=Ni0ANon4kI8Ro3YIh_jt1-7Ucs12KmWmE7QDq_MDMgw,6464
40
+ guppylang_internals/compiler/modifier_compiler.py,sha256=LrPLldlcFSjhKdHmx8034SLwKLRI-SE8LhEXcOLDNnQ,6506
41
41
  guppylang_internals/compiler/qtm_platform_extension.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
42
42
  guppylang_internals/compiler/stmt_compiler.py,sha256=cdOgqzRVP1hYeGbGftgY8LlFRHLWdgFPjlhK-khoMvw,9340
43
43
  guppylang_internals/definition/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -46,10 +46,11 @@ guppylang_internals/definition/const.py,sha256=71QVX3xqSaC0u4bsYHPbR_0Csz1Es-P7H
46
46
  guppylang_internals/definition/custom.py,sha256=sPYY8o1_WuSNHQazV4KCvUcLer8mvepTYb285XMGkEM,19683
47
47
  guppylang_internals/definition/declaration.py,sha256=vwo7P6D3TJU_6wfTWmx6KnmjOCCGLiGjJQ-Zf_02rYM,6038
48
48
  guppylang_internals/definition/extern.py,sha256=hEajRYaapKIfX9J7scnusQHc1e_bCxB4oUVWZ-D4c8o,2878
49
- guppylang_internals/definition/function.py,sha256=LPWvQrlzTnY_18n_myD063p7KdXM51CJIIjmpdBTStY,11395
50
- guppylang_internals/definition/overloaded.py,sha256=UQ64waMp48gEVDCqEzuJFrRoNJ9saUIRUAynF3T-Gz8,5132
49
+ guppylang_internals/definition/function.py,sha256=974WcrXQi4X9aZMGjP3pWqCkHK_WHbH4Ux1HRAMiheQ,11682
50
+ guppylang_internals/definition/metadata.py,sha256=S3YO0X7YVCxyiTw5KJNNCXdFaprCx8pcX3tPWiWnM2o,3013
51
+ guppylang_internals/definition/overloaded.py,sha256=jwrzaL_P1fYW9TTL-gnPAe0gHLN2kDPbG1-muKT0u1Q,5613
51
52
  guppylang_internals/definition/parameter.py,sha256=l60l-yO34gpeuKZ5D3ru8CS8wnQGuoAgqIUP1CrfOF8,2789
52
- guppylang_internals/definition/pytket_circuits.py,sha256=SkOUg3EwBjpeb3_2PzvkH9xzAvI_OIt-wILY37wv2zI,17010
53
+ guppylang_internals/definition/pytket_circuits.py,sha256=_LCWKc1QzXHdoWommupxMSwdkemjrP5HVUBp4DosrK8,17246
53
54
  guppylang_internals/definition/struct.py,sha256=Jed5kcoc57toQr4f7zeB7mr6fSDP1Q2KRnmGJvbVXF4,15572
54
55
  guppylang_internals/definition/traced.py,sha256=hMHnrLKdbMvmmzmcJRvOCR-WiPHJ3x5ji0am436HNTQ,5592
55
56
  guppylang_internals/definition/ty.py,sha256=5Jt7twY8v1cE7noZ_RYfo0X55KYV6JI0itdHW9vvZs0,2085
@@ -63,8 +64,8 @@ guppylang_internals/std/_internal/debug.py,sha256=j6bGg9TFn4fR8-H8Hk10BfY9Ekanfi
63
64
  guppylang_internals/std/_internal/util.py,sha256=e_sawDuuk1YFpbEQXbpAvWMNeTlkGb4P0t6Ed0JpP9M,8305
64
65
  guppylang_internals/std/_internal/compiler/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
65
66
  guppylang_internals/std/_internal/compiler/arithmetic.py,sha256=_Nf-P3GwTp-ZVLz62Hz9ModD74R41hKqutNGmp5Mn6g,4287
66
- guppylang_internals/std/_internal/compiler/array.py,sha256=YTFzInN7DkU4M_AASHR__D_9bouvaNrYNRKxsO3-Fek,13491
67
- guppylang_internals/std/_internal/compiler/either.py,sha256=LzLSfsafwVAgaeX8d91IRmrxK6kx0YC_MtGSBEgBsbs,4716
67
+ guppylang_internals/std/_internal/compiler/array.py,sha256=l3FqmqRr-95a0lkTW1-MCd2VzFDBYHZR2-Aw38gW0bY,14803
68
+ guppylang_internals/std/_internal/compiler/either.py,sha256=LEVPfkINfYr5qENkszzgYYI5zrjaYPHlPnk0nNBrBaA,5425
68
69
  guppylang_internals/std/_internal/compiler/frozenarray.py,sha256=BZMSSYTieqcFaAXGTR0nw2b7eN5LK2Et4vNZSBFRcyI,2361
69
70
  guppylang_internals/std/_internal/compiler/futures.py,sha256=nIaxXCGj4BPI_to_Q87gQEqN94Q8hb09ICkODZVOJrQ,1095
70
71
  guppylang_internals/std/_internal/compiler/list.py,sha256=Tqvs-J7iL5TxG5qgk-dboXU3-y7uZq-tQ9r9xFhmw4c,12574
@@ -74,14 +75,14 @@ guppylang_internals/std/_internal/compiler/platform.py,sha256=3TMYdRO--Sabapo4K0
74
75
  guppylang_internals/std/_internal/compiler/prelude.py,sha256=2pOmi1JNBHsETkC4EGskbFBAZAlAJ4IvWZLe5v4DIFM,9635
75
76
  guppylang_internals/std/_internal/compiler/qsystem.py,sha256=dKSpvpxF7WRfWuDj0u7zShEhTL6mkAr9pQNyYVoa8vM,1940
76
77
  guppylang_internals/std/_internal/compiler/quantum.py,sha256=gXuB1vpRl8ipgwwEYPCgoMPiqPUJ908Msl09jJFdWxg,3930
77
- guppylang_internals/std/_internal/compiler/tket_bool.py,sha256=ceO9BBF3HhjNAkc4dObJBH13Kpn08-pSaksjl3yoOa4,1207
78
- guppylang_internals/std/_internal/compiler/tket_exts.py,sha256=E7Ywu6xiMepkFoNYZ90rBMPLi3l1MlZSTJE0YmO6TAo,1540
78
+ guppylang_internals/std/_internal/compiler/tket_bool.py,sha256=yvZRArJIVnCysdfvg6TSz61wwt9ikZh5N5EX4DF2UfE,1114
79
+ guppylang_internals/std/_internal/compiler/tket_exts.py,sha256=UP43DbvDoXetM0qIYGEbTx4h0lINf3n5GZ67VphMUp8,1514
79
80
  guppylang_internals/std/_internal/compiler/wasm.py,sha256=1G8EzrnN3Yv12hIdv2XOg4Hq-QlvRYl7-4QbZYLYyM4,5727
80
81
  guppylang_internals/tracing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
81
82
  guppylang_internals/tracing/builtins_mock.py,sha256=iKgrs626DVhdN7nJroKBLstWGwkr7PzJI4CrgqkMyTA,2963
82
83
  guppylang_internals/tracing/frozenlist.py,sha256=sINk-PZTw4dNThF5GK9AZxAeX5ap-g_hbqxZ79GtLAc,1823
83
84
  guppylang_internals/tracing/function.py,sha256=K2rEey0awOxwfljGk4uezRmXode7rgOKQY1VN94wOIo,7901
84
- guppylang_internals/tracing/object.py,sha256=UMysud9Cc4pHqIDF2qn0zwo97q5d1IqMn1CHxvcitBs,20393
85
+ guppylang_internals/tracing/object.py,sha256=WWlYUMcNjS9XKGR6NEJKd7v9rtrensAHizySppiJPfo,20558
85
86
  guppylang_internals/tracing/state.py,sha256=J-fG0dZh9IeB6hpLfyp5IwqS2TW0Zr8XloMmuIHWS6Q,2083
86
87
  guppylang_internals/tracing/unpacking.py,sha256=6Df9h4pFS6mebyU3VR5DfO87Rs_QbTdSkLMNjpaM0Xc,8728
87
88
  guppylang_internals/tracing/util.py,sha256=zzVUeY7Ax4v_ZQh7QmckYaOWsg7BRZg6-oX4VWmytDU,3054
@@ -98,7 +99,7 @@ guppylang_internals/tys/qubit.py,sha256=Y7RRc3_bP9LIoAMqjDsVNVzaplgF7h26L2OJB5Xp
98
99
  guppylang_internals/tys/subst.py,sha256=fMIh7jNMMNiKjlr3WMxAwY_ovX1qTaz_c5foruYkLPs,3049
99
100
  guppylang_internals/tys/ty.py,sha256=kRkI_QfPbITKuHre29Ejha55Y68j-aiLAWSBdvO1Ma8,31115
100
101
  guppylang_internals/tys/var.py,sha256=zACXv2IvGrqjDryC6lMyZpNnDb3SBRM2SlTOyq6WJdo,1173
101
- guppylang_internals-0.26.0.dist-info/METADATA,sha256=yTv-p1nskM4Z4zIz0laFimpTCmF5bYPq6NxG_t_h8PY,14853
102
- guppylang_internals-0.26.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
103
- guppylang_internals-0.26.0.dist-info/licenses/LICENCE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
104
- guppylang_internals-0.26.0.dist-info/RECORD,,
102
+ guppylang_internals-0.27.0.dist-info/METADATA,sha256=6xRat3Ig_bf94-LOSR_KqMeXJgUqpIyiGqMzobzhAdE,14853
103
+ guppylang_internals-0.27.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
104
+ guppylang_internals-0.27.0.dist-info/licenses/LICENCE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
105
+ guppylang_internals-0.27.0.dist-info/RECORD,,