Branch: refs/heads/main
Revision: 5aa4bcf
Author: vasslitvinov
Link: Domain stabilization items by vasslitvinov · Pull Request #19356 · chapel-lang/chapel · GitHub
Log Message:
Merge pull request #19356 from vasslitvinov/domain-stabilization
Domain stabilization items
This PR implements several minor action items from Domain module review and adds tests.
-
Clear compiler errors for operators
#
,by
,align
when they are
invoked incorrectly.
Move array overloads for#
from ChapelDomain.chpl to ChapelArray.chpl.
Errors for those overloads are now reported by the domain#
.
Add some error overloads. -
Make it a compiler error to invoke
==
or!=
on domains of a
different kind, ex. on a rectangular domain and an irregular domain.
Introduce the functionchpl_sameDomainKind
to guard such
comparisons when desired. It is now used in one case in
ChapelAutoLocalAccess.chpl where it is OK that two domains compare
as not equal when they are of a different kind. -
Add missing implementations of
dsiTargetLocales()
to DefaultDist,
DefaultAssociative and DefaultSparse. dsiTargetLocales was
introduced in 0289958038 with these cases left unimplemented.
WHILE THERE
-
Add pragma "last resort" on some error overloads.
-
Remove some where-clauses to facilitate error reporting and reduce
the amount of work for resolution. -
Reorder some existing error overloads to match the order of those
methods established in #19307. -
Remove two
return r;
that follow compilerError() as unreachable.
This resulted in additional compilation errors in four tests that are
compiled with --ignore-errors-for-pass. I updated their .good files. -
Issue "unstable" warnings in
bulkAdd
andmakeIndexBuffer
and
update the documentation for the former to indicate that it is unstable.
The latter already had that verbage.
DISCUSSION: promotability of #, by, align
This implements the suggestion in
Should the operators `#` `by` `align` be promotable? · Issue #19348 · chapel-lang/chapel · GitHub
The operators #
by
align
are now promotable over the first operand.
W.r.t. the second operand:
- operators
align
on range and#
are promotable because their "normal"
overloads accept the second argument only of a certain type, roughly:
operator #(r:range(?i), count:chpl__rangeStrideType(i)) // return a new range
/last resort/ operator #(r: range(?i), count) // error "incorrect count type"
/last resort/ operator #(r, count) // error "# not supported on r.type"
- operators
align
on domain andby
are not promotable because
their "normal" overloads have an unrestricted-generic second
argument, with error checking done internally:
operator by(r : range(?), step) // return a new range or report an error
/last resort/ operator by(r, step) // error "'by' is not supported on r.type"
In the current implementation, the presence of a blanket last-resort
overload prevents the possibility of forwarding the operators. I
propose that we change the behavior so that forwarding takes precedence
over last-resort.
DISCUSSION: error overloads for dsiTargetLocales() et al.
I did not add last-resort error overloads for dsiTargetLocales() in
the style of #19070. Because otherwise I'd have to add the overload
annotation to a bunch of existing implementations of dsiTargetLocales
for all our domain maps. This seemed like an overkill.
Should we add missing last-resort error overloads for the other
methods systematized in #19307? Seems like a good idea, however might
be an overkill especially for methods like dsiDims() and dsiNumIndices()
that, really, every domain map should implement.
OTHER POTENTIAL NEXT STEPS
-
Remove
inline
on some implementations of domain==
that contain for-loops. -
Turn
chpl_sameDomainKind()
into a user-facing function.
Perhaps rename it to something likeisEqualityComparisonAvailable()
.
r: @stonea
Modified Files:
A test/arrays/compilerErrors/opCount-assoc.chpl
A test/arrays/compilerErrors/opCount-assoc.good
A test/arrays/compilerErrors/opCount-int.chpl
A test/arrays/compilerErrors/opCount-int.good
A test/arrays/compilerErrors/opCount-rank.chpl
A test/arrays/compilerErrors/opCount-rank.good
A test/arrays/compilerErrors/opCount-sparse.chpl
A test/arrays/compilerErrors/opCount-sparse.good
A test/domains/compilerErrors/notsupportedEq-assoc-sparse.chpl
A test/domains/compilerErrors/notsupportedEq-assoc-sparse.good
A test/domains/compilerErrors/notsupportedEq-dr-assoc.chpl
A test/domains/compilerErrors/notsupportedEq-dr-assoc.good
A test/domains/compilerErrors/notsupportedEq-dr-sparse.chpl
A test/domains/compilerErrors/notsupportedEq-dr-sparse.good
A test/domains/compilerErrors/notsupportedNeq-assoc-sparse.chpl
A test/domains/compilerErrors/notsupportedNeq-assoc-sparse.good
A test/domains/compilerErrors/notsupportedNeq-dr-assoc.chpl
A test/domains/compilerErrors/notsupportedNeq-dr-assoc.good
A test/domains/compilerErrors/notsupportedNeq-dr-sparse.chpl
A test/domains/compilerErrors/notsupportedNeq-dr-sparse.good
A test/domains/compilerErrors/notsupportedOpAlign-assoc.chpl
A test/domains/compilerErrors/notsupportedOpAlign-assoc.good
A test/domains/compilerErrors/notsupportedOpAlign-sparse.chpl
A test/domains/compilerErrors/notsupportedOpAlign-sparse.good
A test/domains/compilerErrors/notsupportedOpBy-assoc.chpl
A test/domains/compilerErrors/notsupportedOpBy-assoc.good
A test/domains/compilerErrors/notsupportedOpBy-sparse.chpl
A test/domains/compilerErrors/notsupportedOpBy-sparse.good
A test/domains/compilerErrors/notsupportedOpCount-assoc.chpl
A test/domains/compilerErrors/notsupportedOpCount-assoc.good
A test/domains/compilerErrors/notsupportedOpCount-int.chpl
A test/domains/compilerErrors/notsupportedOpCount-int.good
A test/domains/compilerErrors/notsupportedOpCount-rank.chpl
A test/domains/compilerErrors/notsupportedOpCount-rank.good
A test/domains/compilerErrors/notsupportedOpCount-sparse.chpl
A test/domains/compilerErrors/notsupportedOpCount-sparse.good
A test/unstable/bulkAddAndMIB.chpl
A test/unstable/bulkAddAndMIB.good
M modules/internal/ChapelArray.chpl
M modules/internal/ChapelAutoLocalAccess.chpl
M modules/internal/ChapelDistribution.chpl
M modules/internal/ChapelDomain.chpl
M modules/internal/ChapelRange.chpl
M modules/internal/DefaultAssociative.chpl
M modules/internal/DefaultRectangular.chpl
M modules/internal/DefaultSparse.chpl
M test/types/range/hilde/alignTypeError1.good
M test/types/range/hilde/alignTypeError2.good
M test/types/range/hilde/countTypeError1.good
M test/types/range/hilde/countTypeError2.good
M test/types/range/stonea/countedRangeBy-2.good
Compare: https://github.com/chapel-lang/chapel/compare/13eb718caec2...5aa4bcfd3956