Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate <~> operator #19985

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
2efe74b
Replace <~> in distributions with calls to write/writeln
benharsh Jun 13, 2022
da0184c
Update package modules to no longer use <~>
benharsh Jun 13, 2022
7c2ff31
Update locale models to no longer use <~>
benharsh Jun 13, 2022
58366d5
Trivial changes to no longer use <~> in internal modules
benharsh Jun 13, 2022
a3901fb
Update DefaultAssociative to no longer use <~>
benharsh Jun 13, 2022
b70dce7
Add test to specifically exercise IO behavior when reading in Default…
benharsh Jun 15, 2022
ac8a236
Update DefaultRectangular to no longer use <~>
benharsh Jun 13, 2022
dc58fd6
Update LayoutCS to no longer use <~>
benharsh Jun 13, 2022
a84e035
Trivial updates to standard modules to no longer use <~>
benharsh Jun 13, 2022
abdc772
Update IO module to no longer use <~>
benharsh Jun 13, 2022
6b899fe
Update DateTime module to no longer use <~>
benharsh Jun 13, 2022
69efddc
Update Map to no longer use <~>
benharsh Jun 13, 2022
315a994
Update ChapelIO to no longer use <~>
benharsh Jun 13, 2022
411ba49
Deprecate <~> operator
benharsh Jun 13, 2022
d7ca3a8
Add documentation note that <~> is deprecated
benharsh Jun 13, 2022
42de93c
Trivially update tests to no longer use <~>
benharsh Jun 13, 2022
e8d8eb8
Update operator tests with deprecation warnings for <~>
benharsh Jun 13, 2022
3b08562
Update record IO tests to no longer use <~>
benharsh Jun 13, 2022
72095d4
Update line number in .good file
benharsh Jun 15, 2022
e11a320
Add compiler warning for user-defined <~> operators, and update tests
benharsh Jun 15, 2022
9affc91
Add deprecation test for <~> operator
benharsh Jun 15, 2022
ba089ad
fix test output with <~> deprecation warnings
benharsh Jun 15, 2022
0ef5dad
Fix prediff to remove only logging text
benharsh Jun 16, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions compiler/passes/checkParsed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,13 @@ static void checkOperator(FnSymbol* fn) {
} else {
if (!isAstrOpName(fn->name)) {
USR_FATAL_CONT(fn, "'%s' is not a legal operator name", fn->name);
} else if (astr("<~>") == astr(fn->name)) {
if (fn->hasFlag(FLAG_DEPRECATED) == false) {
const char* msg = astr("the <~> operator is deprecated");
USR_WARN(fn, "%s", msg);
fn->addFlag(FLAG_DEPRECATED);
fn->deprecationMsg = msg;
}
}
}
}
Expand Down
22 changes: 11 additions & 11 deletions modules/dists/BlockCycDist.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -317,15 +317,15 @@ override proc BlockCyclic.dsiNewRectangularDom(param rank: int, type idxType,
// output distribution
//
proc BlockCyclic.writeThis(x) throws {
x <~> "BlockCyclic\n";
x <~> "-------\n";
x <~> "distributes: " <~> lowIdx <~> "..." <~> "\n";
x <~> "in chunks of: " <~> blocksize <~> "\n";
x <~> "across locales: " <~> targetLocales <~> "\n";
x <~> "indexed via: " <~> targetLocDom <~> "\n";
x <~> "resulting in: " <~> "\n";
x.writeln("BlockCyclic");
x.writeln("-------");
x.writeln("distributes: ", lowIdx, "...");
x.writeln("in chunks of: ", blocksize);
x.writeln("across locales: ", targetLocales);
x.writeln("indexed via: ", targetLocDom);
x.writeln("resulting in: ");
for locid in targetLocDom do
x <~> " [" <~> locid <~> "] " <~> locDist(locid) <~> "\n";
x.writeln(" [", locid, "] ", locDist(locid));
}

//
Expand Down Expand Up @@ -488,7 +488,7 @@ proc LocBlockCyclic.writeThis(x) throws {
on this {
localeid = here.id;
}
x <~> "locale " <~> localeid <~> " owns blocks: " <~> myStarts;
x.write("locale ", localeid, " owns blocks: ", myStarts);
}

////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -772,7 +772,7 @@ proc LocBlockCyclicDom.computeFlatInds() {
// output local domain piece
//
proc LocBlockCyclicDom.writeThis(x) throws {
x <~> myStarts;
x.write(myStarts);
}

proc LocBlockCyclicDom.enumerateBlocks() {
Expand Down Expand Up @@ -1276,7 +1276,7 @@ proc LocBlockCyclicArr.this(i) ref {
//
proc LocBlockCyclicArr.writeThis(x) throws {
// note on this fails; see writeThisUsingOn.chpl
x <~> myElems;
x.write(myElems);
}

// sungeun: This doesn't appear to be used yet, so I left it, but it
Expand Down
16 changes: 8 additions & 8 deletions modules/dists/BlockDist.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -632,15 +632,15 @@ override proc Block.dsiNewSparseDom(param rank: int, type idxType,
// output distribution
//
proc Block.writeThis(x) throws {
x <~> "Block" <~> "\n";
x <~> "-------" <~> "\n";
x <~> "distributes: " <~> boundingBox <~> "\n";
x <~> "across locales: " <~> targetLocales <~> "\n";
x <~> "indexed via: " <~> targetLocDom <~> "\n";
x <~> "resulting in: " <~> "\n";
x.writeln("Block");
x.writeln("-------");
x.writeln("distributes: ", boundingBox);
x.writeln("across locales: ", targetLocales);
x.writeln("indexed via: ", targetLocDom);
x.writeln("resulting in: ");
for locid in targetLocDom do
x <~> " [" <~> locid <~> "] locale " <~> locDist(locid).locale.id <~>
" owns chunk: " <~> locDist(locid).myChunk <~> "\n";
x.writeln(" [", locid, "] locale ", locDist(locid).locale.id,
" owns chunk: ", locDist(locid).myChunk);
}

proc Block.dsiIndexToLocale(ind: idxType) where rank == 1 {
Expand Down
18 changes: 9 additions & 9 deletions modules/dists/CyclicDist.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -395,11 +395,11 @@ proc _cyclic_matchArgsShape(type rangeType, type scalarType, args) type {
}

proc Cyclic.writeThis(x) throws {
x <~> this.type:string <~> "\n";
x <~> "------\n";
x.writeln(this.type:string);
x.writeln("------");
for locid in targetLocDom do
x <~> " [" <~> locid <~> "=" <~> targetLocs(locid) <~> "] owns chunk: " <~>
locDist(locid).myChunk <~> "\n";
x.writeln(" [", locid, "=", targetLocs(locid), "] owns chunk: ",
locDist(locid).myChunk);
}

proc Cyclic.targetLocsIdx(i: idxType) {
Expand Down Expand Up @@ -590,14 +590,14 @@ proc CyclicDom.dsiAssignDomain(rhs: domain, lhsPrivate:bool) {

proc CyclicDom.dsiSerialWrite(x) {
if verboseCyclicDistWriters {
x <~> this.type:string <~> "\n";
x <~> "------\n";
x.writeln(this.type:string);
x.writeln("------");
for loc in dist.targetLocDom {
x <~> "[" <~> loc <~> "=" <~> dist.targetLocs(loc) <~> "] owns " <~>
locDoms(loc).myBlock <~> "\n";
x.writeln("[", loc, "=", dist.targetLocs(loc), "] owns ",
locDoms(loc).myBlock);
}
} else {
x <~> whole;
x.write(whole);
}
}

Expand Down
20 changes: 10 additions & 10 deletions modules/dists/HashedDist.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -236,14 +236,14 @@ class Hashed : BaseDist {
// print out the distribution
//
proc writeThis(x) throws {
x <~> "Hashed\n";
x <~> "-------\n";
x <~> "distributed using: " <~> mapper <~> "\n";
x <~> "across locales: " <~> targetLocales <~> "\n";
x <~> "indexed via: " <~> targetLocDom <~> "\n";
x <~> "resulting in: " <~> "\n";
x.writeln("Hashed");
x.writeln("-------");
x.writeln("distributed using: ", mapper);
x.writeln("across locales: ", targetLocales);
x.writeln("indexed via: ", targetLocDom);
x.writeln("resulting in: ");
//for locid in targetLocDom do
// x <~> " [" <~> locid <~> "] " <~> locDist(locid) <~> "\n";
// x.writeln(" [", locid, "] ", locDist(locid));
}

//
Expand Down Expand Up @@ -473,7 +473,7 @@ class UserMapAssocDom: BaseAssociativeDom {
//
// ("locale" + here.id + " owns: ").writeThis(x);

x <~> locDom;
x.write(locDom);
// }
}

Expand Down Expand Up @@ -896,13 +896,13 @@ class UserMapAssocArr: AbsBaseArr {

var printBraces = (isjson || ischpl);

if printBraces then f <~> new ioLiteral("[");
if printBraces then f.write(new ioLiteral("["));

var first = true;
for locArr in locArrs {
locArr!.myElems._value.dsiSerialReadWrite(f, printBraces=false, first);
}
if printBraces then f <~> new ioLiteral("]");
if printBraces then f.write(new ioLiteral("]"));

}

Expand Down
8 changes: 4 additions & 4 deletions modules/dists/PrivateDist.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class Private: BaseDist {
}

proc writeThis(x) throws {
x <~> "Private Distribution\n";
x.writeln("Private Distribution");
}

// acts like a singleton
Expand Down Expand Up @@ -111,7 +111,7 @@ class PrivateDom: BaseRectangularDom {
yield i;
}

proc dsiSerialWrite(x) { x <~> "Private Domain"; }
proc dsiSerialWrite(x) { x.write("Private Domain"); }

proc dsiBuildArray(type eltType, param initElts:bool) {
return new unmanaged PrivateArr(eltType=eltType, rank=rank,
Expand Down Expand Up @@ -307,8 +307,8 @@ iter PrivateArr.these(param tag: iterKind, followThis) ref where tag == iterKind
proc PrivateArr.dsiSerialWrite(x) {
var first: bool = true;
for i in dom {
if first then first = !first; else x <~> " ";
x <~> dsiAccess(i);
if first then first = !first; else x.write(" ");
x.write(dsiAccess(i));
}
}

Expand Down
13 changes: 6 additions & 7 deletions modules/dists/SparseBlockDist.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -230,16 +230,16 @@ class SparseBlockDom: BaseSparseDomImpl {
//
proc dsiSerialWrite(f) {
if (rank == 1) {
f <~> "{";
f.write("{");
for locdom in locDoms do {
// on locdom do {
if (locdom!.dsiNumIndices) {
f <~> " ";
f.write(" ");
locdom!.dsiSerialWrite(f);
}
//}
}
f <~> "}";
f.write("}");
} else {
compilerError("Can't write out multidimensional sparse distributed domains yet");
}
Expand Down Expand Up @@ -369,7 +369,6 @@ class LocSparseBlockDom {
proc dsiSerialWrite(w) {
mySparseBlock._value.dsiSerialWrite(w, printBrackets=false);
// w.write(mySparseBlock); // works, but gets brackets printed out redundantly
// w <~> mySparseBlock;
}

proc dsiNumIndices {
Expand Down Expand Up @@ -791,16 +790,16 @@ proc LocSparseBlockArr.this(i) ref {
//
proc SparseBlockArr.dsiSerialWrite(f) {
if (rank == 1) {
f <~> "[";
f.write("[");
for locarr in locArr do {
// on locdom do {
if (locarr!.locDom.dsiNumIndices) {
f <~> " ";
f.write(" ");
locarr!.dsiSerialWrite(f);
}
// }
}
f <~> "]";
f.write("]");
} else {
compilerError("Can't write out multidimensional sparse distributed arrays yet");
}
Expand Down
22 changes: 11 additions & 11 deletions modules/dists/StencilDist.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -579,15 +579,15 @@ override proc Stencil.dsiNewRectangularDom(param rank: int, type idxType,
// output distribution
//
proc Stencil.writeThis(x) throws {
x <~> "Stencil\n";
x <~> "-------\n";
x <~> "distributes: " <~> boundingBox <~> "\n";
x <~> "across locales: " <~> targetLocales <~> "\n";
x <~> "indexed via: " <~> targetLocDom <~> "\n";
x <~> "resulting in: " <~> "\n";
x.writeln("Stencil");
x.writeln("-------");
x.writeln("distributes: ", boundingBox);
x.writeln("across locales: ", targetLocales);
x.writeln("indexed via: ", targetLocDom);
x.writeln("resulting in: ");
for locid in targetLocDom do
x <~> " [" <~> locid <~> "] locale " <~> locDist(locid).locale.id <~>
" owns chunk: " <~> locDist(locid).myChunk <~> "\n";
x.writeln(" [", locid, "] locale ", locDist(locid).locale.id,
" owns chunk: ", locDist(locid).myChunk);
}

proc Stencil.dsiIndexToLocale(ind: idxType) where rank == 1 {
Expand Down Expand Up @@ -1365,16 +1365,16 @@ proc StencilArr.dsiSerialWrite(f) {
for dim in 0..rank-1 do
i(dim) = dom.dsiDim(dim).lowBound;
label next while true {
f <~> do_dsiAccess(true, i);
f.write(do_dsiAccess(true, i));
if i(rank-1) <= (dom.dsiDim(rank-1).highBound - dom.dsiDim(rank-1).stride:strType) {
if ! binary then f <~> " ";
if ! binary then f.write(" ");
i(rank-1) += dom.dsiDim(rank-1).stride:strType;
} else {
for dim in 0..rank-2 by -1 {
if i(dim) <= (dom.dsiDim(dim).highBound - dom.dsiDim(dim).stride:strType) {
i(dim) += dom.dsiDim(dim).stride:strType;
for dim2 in dim+1..rank-1 {
f <~> "\n";
f.writeln();
i(dim2) = dom.dsiDim(dim2).lowBound;
}
continue next;
Expand Down
8 changes: 4 additions & 4 deletions modules/internal/ArrayViewRankChange.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -322,13 +322,13 @@ module ArrayViewRankChange {
for d in 0..downrank-1 do
if !collapsedDim(d) {
if first {
f <~> "{";
f.write("{");
first = false;
} else
f <~> ", ";
f <~> downDom.dsiDim(d);
f.write(", ");
f.write(downDom.dsiDim(d));
}
f <~> "}";
f.write("}");
}

override proc dsiMyDist() {
Expand Down
4 changes: 2 additions & 2 deletions modules/internal/Atomics.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ module Atomics {

pragma "no doc"
proc const writeThis(x) throws {
x <~> read();
x.write(read());
}

}
Expand Down Expand Up @@ -730,7 +730,7 @@ module Atomics {

pragma "no doc"
proc const writeThis(x) throws {
x <~> read();
x.write(read());
}

}
Expand Down
4 changes: 2 additions & 2 deletions modules/internal/ChapelIteratorSupport.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -357,10 +357,10 @@ module ChapelIteratorSupport {
var first: bool = true;
for e in this {
if !first then
f <~> " ";
f.write(" ");
else
first = false;
f <~> e;
f.write(e);
}
}

Expand Down
4 changes: 2 additions & 2 deletions modules/internal/ChapelSyncvar.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -1209,11 +1209,11 @@ private module AlignedTSupport {
// read/write support
proc aligned_t.writeThis(f) throws {
var tmp : uint(64) = this : uint(64);
f <~> tmp;
f.write(tmp);
}
proc aligned_t.readThis(f) throws {
var tmp : uint(64);
f <~> tmp;
f.readIt(tmp);
this = tmp : aligned_t;
}
}
Loading