Skip to content

Fix dispatch ambiguities by restricting aud to audgz (d>0:shp)#255

Open
rubenhensen wants to merge 1 commit intoSacBase:masterfrom
rubenhensen:fix/dispatch-ambiguity
Open

Fix dispatch ambiguities by restricting aud to audgz (d>0:shp)#255
rubenhensen wants to merge 1 commit intoSacBase:masterfrom
rubenhensen:fix/dispatch-ambiguity

Conversation

@rubenhensen
Copy link
Copy Markdown

Replace [d:shp] with [d>0:shp] in commutative overload pairs where one function was more specific in one arg position but less specific in another, causing the new dispatch rule to reject them.

  • Quaternion.xsac: * operator scalar×aud / aud×scalar overloads
  • arraybasics.mac: MODARRAY_AxVxS conflicting with MODARRAY_AxSxA
  • ArrayTransform.xsac: WHERE AxS / SxA overloads
  • ComplexArrayArith.xsac: MAP_BIN AxS / SxA overloads

Has to do with: https://gitlab.sac-home.org/sac-group/sac2c/-/merge_requests/637

Replace [d:shp] with [d>0:shp] in commutative overload pairs
where one function was more specific in one arg position but less
specific in another, causing the new dispatch rule to reject them.

- Quaternion.xsac: * operator scalar×aud / aud×scalar overloads
- arraybasics.mac: MODARRAY_AxVxS conflicting with MODARRAY_AxSxA
- ArrayTransform.xsac: WHERE AxS / SxA overloads
- ComplexArrayArith.xsac: MAP_BIN AxS / SxA overloads
Comment thread include/arraybasics.mac
}

#define MODARRAY_AxVxS(typ, _postfix, _fmt, _zval, _oval) \
inline typ[d:shp] modarray(typ[d:shp] arr, int[d] idx, typ val) \
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we have to exclude the scalar case?

I think we have [*] [.] [*] , [*] [.] [], and [.,*] [] [*]. which should be ok to coexist, no?!

#define WHERE_AxA(typ, _postfix, _fmt, _zval, _oval) \
inline \
typ[d:shp] where(bool[d:shp] p, typ[d:shp] A, typ[d:shp] B) \
typ[d>0:shp] where(bool[d>0:shp] p, typ[d>0:shp] A, typ[d>0:shp] B) \
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should add a 4th implementation that caters for the "all scalar" case. we could implement that by a normal conditional....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants