@@ -387,7 +387,10 @@ def from_piece_and_aff(piece: Set, aff: Aff) -> PwAff:
387387 if not piece .space .order_equal (aff .space .as_set_space ()):
388388 raise ValueError ("spaces don't match" )
389389
390- return PwAff (isl .PwAff .alloc (piece ._obj , aff ._obj ), aff .space )
390+ if aff .space .dim (DimType .in_ ):
391+ return PwAff (isl .PwAff .alloc (piece ._obj , aff ._obj ), aff .space )
392+ else :
393+ return PwAff (isl .PwAff .alloc (piece ._obj .params (), aff ._obj ), aff .space )
391394
392395 def var_pw_aff (self : PwAff , name : str ) -> PwAff :
393396 """Return a :class:`PwAff` that evaluates to *name* in the space of *self*."""
@@ -419,7 +422,10 @@ def where(self,
419422 self .space )
420423 self_a , rhs_a = align_two (self , rhs )
421424 from .set_like import Set
422- return Set (func (self_a ._obj , rhs_a ._obj ), self_a .space .as_set_space ())
425+ res_set = func (self_a ._obj , rhs_a ._obj )
426+ return Set (
427+ res_set .from_params () if res_set .is_params () else res_set ,
428+ self_a .space .as_set_space ())
423429
424430 def eq_set (self , rhs : int | PwAff ) -> Set : return self .where ("=" , rhs )
425431 def ne_set (self , rhs : int | PwAff ) -> Set : return self .where ("!=" , rhs )
@@ -447,7 +453,9 @@ def get_pieces(self) -> list[tuple[Set, Aff]]:
447453 set_space = self .space .as_set_space ()
448454 from .set_like import Set
449455 return [
450- (Set (set , set_space ), Aff (aff , self .space ))
456+ (Set (set .from_params () if set .is_params () else set ,
457+ set_space ),
458+ Aff (aff , self .space ))
451459 for set , aff in self ._obj .get_pieces ()
452460 ]
453461
@@ -456,7 +464,10 @@ def coalesce(self) -> PwAff:
456464
457465 def get_aggregate_domain (self ) -> Set :
458466 from .set_like import Set
459- return Set (self ._obj .get_aggregate_domain (), self .space .as_set_space ())
467+ agg_domain = self ._obj .get_aggregate_domain ()
468+ return Set (
469+ agg_domain .from_params () if agg_domain .is_params () else agg_domain ,
470+ self .space .as_set_space ())
460471
461472 def union_max (self , other : PwAff ) -> PwAff :
462473 self_a , other_a = align_two (self , other )
0 commit comments