Skip to content

Commit 2a07eee

Browse files
committed
invariance
1 parent 60d90ab commit 2a07eee

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

edg/core/Array.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020

2121
class MapExtractBinding(Binding):
22-
def __init__(self, container: Vector, elt: ConstraintExpr):
22+
def __init__(self, container: BaseVector, elt: ConstraintExpr):
2323
super().__init__()
2424
self.container = container
2525
self.elt = elt
@@ -28,7 +28,7 @@ def get_subexprs(self) -> Iterable[Union[ConstraintExpr, BasePort]]:
2828
return [self.container]
2929

3030
def expr_to_proto(self, expr: ConstraintExpr, ref_map: Refable.RefMapType) -> edgir.ValueExpr:
31-
contained_map = self.container._elt_sample._create_ref_map(edgir.LocalPath())
31+
contained_map = self.container._get_elt_sample()._create_ref_map(edgir.LocalPath())
3232

3333
pb = edgir.ValueExpr()
3434
pb.map_extract.container.ref.CopyFrom(ref_map[self.container]) # TODO support arbitrary refs
@@ -59,7 +59,7 @@ def _get_elt_sample(self) -> BasePort:
5959

6060

6161
# A 'fake'/'intermediate'/'view' vector object used as a return in map_extract operations.
62-
VectorType = TypeVar('VectorType', covariant=True, bound=Port, default=Port)
62+
VectorType = TypeVar('VectorType', bound=Port, default=Port)
6363
@non_library
6464
class DerivedVector(BaseVector, Generic[VectorType]):
6565
# TODO: Library types need to be removed from the type hierarchy, because this does not generate into a library elt

edg/core/Binding.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
if TYPE_CHECKING:
1414
from .Ports import BasePort, Port
15-
from .Array import Vector
15+
from .Array import Vector, BaseVector
1616
from .Blocks import BaseBlock
1717
from .ConstraintExpr import ConstraintExpr, FloatExpr, BoolExpr
1818

@@ -449,7 +449,7 @@ class LengthBinding(Binding):
449449
def __repr__(self) -> str:
450450
return f"Length"
451451

452-
def __init__(self, src: Vector):
452+
def __init__(self, src: BaseVector):
453453
super().__init__()
454454
self.src = src
455455

@@ -467,7 +467,7 @@ class AllocatedBinding(Binding):
467467
def __repr__(self) -> str:
468468
return f"Allocated"
469469

470-
def __init__(self, src: Vector):
470+
def __init__(self, src: BaseVector):
471471
super().__init__()
472472
self.src = src
473473

0 commit comments

Comments
 (0)