Skip to content

CellType.union is not commutative for ByteCellType with UByteCellType, and ShortCellType with UShortCellType #3597

@ElienVandermaesenVITO

Description

@ElienVandermaesenVITO

Similar to #3154

ShortCellType.union(UShortCellType) => ShortCellType
UShortCellType.union(ShortCellType) => UShortCellType

What I would expect is that it covers both of the ranges, so an increase of the bits.

UShortCellType.union(ShortCellType) => IntCellType
ByteCellType.union(UByteCellType) => ShortCellType

Union would than be something like:

def union(other: CellType): CellType =
  if (equalDataType(other))
    self
  else if (bits < other.bits)
    other
  else if (bits > other.bits)
    self
  else if (isFloatingPoint && !other.isFloatingPoint)
    self
  else if  (!isFloatingPoint && other.isFloatingPoint)
    other
  else if (bits == 8)  // ByteCellType and UByteCellType
    ShortCellType
  else  // ShortCellType and UShortCells
    IntCellType 

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions