Branch: refs/heads/main
Revision: 759717f
Author: benharsh
Link: Reduce usage of IO operator in modules and tests by benharsh · Pull Request #20417 · chapel-lang/chapel · GitHub
Log Message:
Merge pull request #20417 from benharsh/reduce-io-op-usage-noliteral
Reduce usage of IO operator in modules and tests
This PR aims to reduce the usage of the IO operator in modules and tests for cases that do not involve ioLiterals and ioNewlines. A future PR will handle those separately for an easier development and review process.
There are a few kinds of changes in this PR:
- updating <~> in
writeThismethods to usechannel.writeinstead. - updating <~> in reading contexts to use
channel.read(type t) : tinstead, and storing the result in a variable - using a conditional in combined read/write contexts with the changes above
We are using the version of channel.read that returns a value because this version will throw on an EOF error. The version that returns a bool will not throw, and requires checking the returned value. It is easy to accidentally fail to check this return value, which can result in surprising behavior (e.g. infinite loops).
Some non-trivial changes were made in support of this effort:
- Splitting
dsiSerialReadWritein DefaultAssociative intodsiSerialReadanddsiSerialWrite. - Changing the structure of the loop in
DefaultRectangularDom.dsiSerialReadWritefor improved readability with the new conditionals - Adding no-doc'd
_readCoremethods to thedateandtimetypes so that we can re-use that logic for readingdatetimetypes- we can't simply call
channel.readbecause the json quotes need to be handled bydatetime.readThis.
- we can't simply call
A new test is added, io/bharshbarg/readArrays.chpl, to more simply reproduce an issue discovered during development where the boolean result of channel.read(ref val) was ignored.
The prediff for optimizations/autoLocalAccess/localArrays.prediff is improved to more selectively remove the logging text. This was discovered when an updated <~> expression changed the ordering of logging and type-printing.
[reviewed-by @jhh67]
Modified Files:
A test/io/bharshbarg/readArrays.chpl
A test/io/bharshbarg/readArrays.execopts
A test/io/bharshbarg/readArrays.good
A test/io/bharshbarg/readArrays.in
M modules/dists/BlockCycDist.chpl
M modules/dists/BlockDist.chpl
M modules/dists/CyclicDist.chpl
M modules/dists/HashedDist.chpl
M modules/dists/PrivateDist.chpl
M modules/dists/SparseBlockDist.chpl
M modules/dists/StencilDist.chpl
M modules/internal/ArrayViewRankChange.chpl
M modules/internal/Atomics.chpl
M modules/internal/ChapelIteratorSupport.chpl
M modules/internal/ChapelSyncvar.chpl
M modules/internal/DefaultAssociative.chpl
M modules/internal/DefaultRectangular.chpl
M modules/internal/DefaultSparse.chpl
M modules/internal/MemConsistency.chpl
M modules/internal/NetworkAtomics.chpl
M modules/internal/OwnedObject.chpl
M modules/internal/SharedObject.chpl
M modules/internal/String.chpl
M modules/internal/localeModels/apu/LocaleModel.chpl
M modules/internal/localeModels/flat/LocaleModel.chpl
M modules/internal/localeModels/gpu/LocaleModel.chpl
M modules/internal/localeModels/numa/LocaleModel.chpl
M modules/layouts/LayoutCS.chpl
M modules/packages/AtomicObjects.chpl
M modules/packages/ConcurrentMap.chpl
M modules/packages/DistributedBag.chpl
M modules/packages/EpochManager.chpl
M modules/packages/LinkedLists.chpl
M modules/packages/Sort.chpl
M modules/packages/SortedMap.chpl
M modules/packages/TOML.chpl
M modules/packages/UnrolledLinkedList.chpl
M modules/standard/BigInteger.chpl
M modules/standard/CTypes.chpl
M modules/standard/ChapelIO.chpl
M modules/standard/CommDiagnostics.chpl
M modules/standard/DateTime.chpl
M modules/standard/Heap.chpl
M modules/standard/IO.chpl
M modules/standard/List.chpl
M modules/standard/Map.chpl
M modules/standard/Random.chpl
M modules/standard/Regex.chpl
M modules/standard/Set.chpl
M modules/standard/Time.chpl
M test/classes/errors/throws/writeThis/NoThrowDefaultGenParent.chpl
M test/constrained-generics/random/MyRandom.chpl
M test/exercises/duplicates/forStudents/FileHashing.chpl
M test/functions/ferguson/ref-pair/tuples/bug-12282.chpl
M test/functions/generic/poi/bug-14185.chpl
M test/io/errors/writeThisUserError.chpl
M test/io/ferguson/readThis/readclass.chpl
M test/io/ferguson/readThis/readclass2.chpl
M test/io/ferguson/readThis/readclass3.chpl
M test/io/ferguson/readThis/readclass5.chpl
M test/io/ferguson/recordeof.chpl
M test/io/recordio.chpl
M test/library/draft/DataFrames/DataFrames.chpl
M test/library/draft/Vector/Vector.chpl
M test/library/packages/HDF5/htable/HTable.chpl
M test/library/packages/Sort/correctness/keyPartEnding.chpl
M test/library/standard/Memory/Initialization/LowLevelBuffer.chpl
M test/optimizations/autoLocalAccess/localArrays-1D-COO.good
M test/optimizations/autoLocalAccess/localArrays-2D-COO.good
M test/optimizations/autoLocalAccess/localArrays.prediff
M test/studies/bale/toposort/toposort.chpl
M test/studies/comd/elegant/arrayOfStructs/util/AccumStencilDist.chpl
M test/types/tuple/dinan/pining_for_lisp.chpl
M test/types/tuple/dinan/pining_for_lisp_ver2.chpl
M test/users/thom/returnGenericLineno/strassen.chpl
Compare: https://github.com/chapel-lang/chapel/compare/3bbd769c4bd2...759717f028e6