Summary
RegionIntersection and RegionUnion cannot combine regions whose real-type parameters differ (e.g. a Float64 region with a BigFloat region).
Details
In src/regions.jl, both structs declare their fields with the same type parameter as the struct, and there is no promoting constructor:
struct RegionIntersection{T} <: AbstractRegion{T}
one::AbstractRegion{T}
two::AbstractRegion{T}
end
The corresponding operations are only defined for matching T:
function intersect(R1::AbstractRegion{T}, R2::AbstractRegion{T}) where {T}
return RegionIntersection(R1, R2)
end
RegionUnion / union have the same shape.
As a result, R_f64 ∩ R_big (and the union equivalent) raises a MethodError because there is no method accepting two different real types. There is an existing # TODO: promote different floating types to common type comment near the struct definitions.
Proposed fix
Add a constructor / method that promotes the two regions to a common real type (via promote_type and convert_real_type) before storing them, so that the stored field types are consistent with the struct's T parameter. Apply to both RegionIntersection/intersect and RegionUnion/union.
Notes
This was previously tracked in a todo.txt file, which has since been removed in favor of GitHub issues.
Summary
RegionIntersectionandRegionUnioncannot combine regions whose real-type parameters differ (e.g. aFloat64region with aBigFloatregion).Details
In
src/regions.jl, both structs declare their fields with the same type parameter as the struct, and there is no promoting constructor:The corresponding operations are only defined for matching
T:RegionUnion/unionhave the same shape.As a result,
R_f64 ∩ R_big(and theunionequivalent) raises aMethodErrorbecause there is no method accepting two different real types. There is an existing# TODO: promote different floating types to common typecomment near the struct definitions.Proposed fix
Add a constructor / method that promotes the two regions to a common real type (via
promote_typeandconvert_real_type) before storing them, so that the stored field types are consistent with the struct'sTparameter. Apply to bothRegionIntersection/intersectandRegionUnion/union.Notes
This was previously tracked in a
todo.txtfile, which has since been removed in favor of GitHub issues.