Fix dispatch ambiguities by restricting aud to audgz (d>0:shp)#255
Merged
sbscholz merged 2 commits intoSacBase:masterfrom Apr 26, 2026
Merged
Fix dispatch ambiguities by restricting aud to audgz (d>0:shp)#255sbscholz merged 2 commits intoSacBase:masterfrom
sbscholz merged 2 commits intoSacBase:masterfrom
Conversation
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
sbscholz
reviewed
Apr 14, 2026
* MODARRAY_AxVxS: revert d>0 -> d:shp. The pair AxVxS / AxSxA is in fact safe because their `idx` types are disjoint (`int[.]` vs scalar `int`), so no call can match both. The previous restriction was a workaround for an over-strict dispatch rule in sac2c which has now been corrected to recognise disjoint positions. * WHERE: add WHERE_SSS, an explicit all-scalar overload using a normal conditional (`p ? A : B`) instead of a with-loop, as Sven suggested. WHERE_SSS is uniformly more specific than WHERE_SxS, so dispatch picks it for fully scalar arguments and avoids the WL overhead.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
Has to do with: https://gitlab.sac-home.org/sac-group/sac2c/-/merge_requests/637