diff --git a/compiler/AST/AggregateType.cpp b/compiler/AST/AggregateType.cpp index 1babb8c9e7cc..9fb5c10d8fc0 100644 --- a/compiler/AST/AggregateType.cpp +++ b/compiler/AST/AggregateType.cpp @@ -3288,3 +3288,31 @@ int64_t AggregateType::cArrayLength() const { USR_FATAL(symbol, "c_array must have positive size"); return sizeInt; } + +Type* AggregateType::arrayElementType() const { + if (!symbol->hasFlag(FLAG_ARRAY)) return nullptr; + Type* ret = nullptr; + Type* instType = this->getField("_instance")->type; + AggregateType* instClass = toAggregateType(canonicalClassType(instType)); + if (!instClass) return nullptr; + TypeSymbol* ts = getDataClassType(instClass->symbol); + // if no eltType here, go to the super class + while (ts == nullptr) { + if (Symbol* super = instClass->getSubstitutionWithName(astr("super"))) { + instClass = toAggregateType(canonicalClassType(super->type)); + ts = getDataClassType(instClass->symbol); + } else break; + } + if (ts != nullptr) ret = ts->type; + return ret; +} + +Type* AggregateType::finalArrayElementType() const { + AggregateType* arrayType = (AggregateType*) this; + Type* ret = nullptr; + do { + ret = arrayType->arrayElementType(); + arrayType = toAggregateType(ret); + } while (arrayType && arrayType->symbol->hasFlag(FLAG_ARRAY)); + return ret; +} diff --git a/compiler/AST/type.cpp b/compiler/AST/type.cpp index ddf9a32b5c4a..38293afec46a 100644 --- a/compiler/AST/type.cpp +++ b/compiler/AST/type.cpp @@ -1843,37 +1843,6 @@ bool isAtomicType(const Type* t) { return t->symbol->hasFlag(FLAG_ATOMIC_TYPE); } -// Returns the element type, given an array type. -static Type* arrayElementType(AggregateType* arrayType) { - Type* eltType = nullptr; - INT_ASSERT(arrayType->symbol->hasFlag(FLAG_ARRAY)); - Type* instType = arrayType->getField("_instance")->type; - AggregateType* instClass = toAggregateType(canonicalClassType(instType)); - TypeSymbol* ts = getDataClassType(instClass->symbol); - // if no eltType here, go to the super class - while (ts == nullptr) { - if (Symbol* super = instClass->getSubstitutionWithName(astr("super"))) { - instClass = toAggregateType(canonicalClassType(super->type)); - ts = getDataClassType(instClass->symbol); - } else break; - } - if (ts != NULL) eltType = ts->type; - - return eltType; -} - -// Returns the element type, given an array type. -// Recurse into it if it is still an array. -static Type* finalArrayElementType(AggregateType* arrayType) { - Type* eltType = nullptr; - do { - eltType = arrayElementType(arrayType); - arrayType = toAggregateType(eltType); - } while (arrayType != nullptr && arrayType->symbol->hasFlag(FLAG_ARRAY)); - - return eltType; -} - static bool isOrContains(Type *type, Flag flag, bool checkRefs = true) { if (type == nullptr) { return false; @@ -1889,7 +1858,7 @@ static bool isOrContains(Type *type, Flag flag, bool checkRefs = true) { if (AggregateType* at = toAggregateType(vt)) { // get backing array instance and recurse if (at->symbol->hasFlag(FLAG_ARRAY)) { - Type* eltType = finalArrayElementType(at); + Type* eltType = at->finalArrayElementType(); if (isOrContains(eltType, flag, checkRefs)) return true; } else if (at->symbol->hasFlag(FLAG_TUPLE)) { // if its a tuple, search the tuple type substitutions diff --git a/compiler/include/AggregateType.h b/compiler/include/AggregateType.h index 33ead9db08dc..14a16533ae07 100644 --- a/compiler/include/AggregateType.h +++ b/compiler/include/AggregateType.h @@ -177,6 +177,8 @@ class AggregateType final : public Type { Type* cArrayElementType() const; int64_t cArrayLength() const; + Type* arrayElementType() const; + Type* finalArrayElementType() const; // // Public fields diff --git a/compiler/passes/initializerRules.cpp b/compiler/passes/initializerRules.cpp index 63b849c86c5c..57b42ea21663 100644 --- a/compiler/passes/initializerRules.cpp +++ b/compiler/passes/initializerRules.cpp @@ -1452,6 +1452,9 @@ static int insertPostInit(AggregateType* at, bool insertSuper) { bool found = false; forv_Vec(FnSymbol, method, at->methods) { + // Happens because we can set slots to 'nullptr' in 'cleanAst'... + if (method == nullptr) continue; + if (method->isPostInitializer()) { if (method->throwsError() == true) { USR_FATAL_CONT(method, "postinit cannot be declared as throws yet"); diff --git a/compiler/resolution/cleanups.cpp b/compiler/resolution/cleanups.cpp index 04e34bf4df16..7898e7cff9d3 100644 --- a/compiler/resolution/cleanups.cpp +++ b/compiler/resolution/cleanups.cpp @@ -854,10 +854,16 @@ static void cleanupNothingVarsAndFields() { seenNothing = true; } } - if (seenNothing && fn->hasFlag(FLAG_AUTO_DESTROY_FN)) { - INT_ASSERT(call->numActuals() == 0); + if (seenNothing) { // A 0-arg call to autoDestroy would upset later passes. - call->remove(); + if (fn->hasFlag(FLAG_AUTO_DESTROY_FN)) { + INT_ASSERT(call->numActuals() == 0); + call->remove(); + } else if (fn->name == astr_initCopy && + fn->retType == dtNothing) { + SET_LINENO(call); + call->replace(new SymExpr(gNone)); + } } } } @@ -884,11 +890,14 @@ static void cleanupNothingVarsAndFields() { } } - // Set for loop index variables that are nothing to the global nothing value + // Set for loop index variables that are nothing to the global nothing value. + // TODO: If we follow this through, does it actually make it past the pass + // 'lowerIterators'? for_alive_in_Vec(BlockStmt, block, gBlockStmts) { if (ForLoop* loop = toForLoop(block)) { - if (loop->indexGet() && loop->indexGet()->typeInfo() == dtNothing) { - loop->indexGet()->setSymbol(gNone); + auto idx = loop->indexGet(); + if (idx && idx->typeInfo() == dtNothing) { + for_SymbolSymExprs(se, idx->symbol()) se->setSymbol(gNone); } } } @@ -896,24 +905,25 @@ static void cleanupNothingVarsAndFields() { // Now that uses of nothing have been cleaned up, remove the // DefExprs for nothing variables. for_alive_in_Vec(DefExpr, def, gDefExprs) { - if (isNothingType(def->sym->type) || - def->sym->type == dtNothing->refType) { - if (VarSymbol* var = toVarSymbol(def->sym)) { - // Avoid removing the "_val" field from refs - // and forall statements' induction/shadow variables. - if (! def->parentSymbol->hasFlag(FLAG_REF) && - ! isForallIterVarDef(def) && - ! preserveShadowVar(var) ) { - if (var != gNone) { - def->remove(); - } - } + if (isNothingType(def->sym->type) || + def->sym->type == dtNothing->refType) { + if (VarSymbol* var = toVarSymbol(def->sym)) { + // Avoid removing the "_val" field from refs + // and forall statements' induction/shadow variables. + if (!def->parentSymbol->hasFlag(FLAG_REF) && + !isForallIterVarDef(def) && + !preserveShadowVar(var) && + var != gNone) { + // Otherwise we may be left with SymExpr that point to garbage. + for_SymbolSymExprs(se, var) se->setSymbol(gNone); + def->remove(); } } else if (def->sym->type == dtUninstantiated && isVarSymbol(def->sym) && !def->parentSymbol->hasFlag(FLAG_REF)) { def->remove(); } + } } adjustNothingShadowVariables(); @@ -923,10 +933,19 @@ static void cleanupNothingVarsAndFields() { // be left in the tree if optimizations are disabled, and can cause codegen // failures later on (at least under LLVM). // - // Solution: Remove SymExprs to none if the expr is at the - // statement level. + // Solution: Remove SymExprs to none if the expr is at the statement level. for_SymbolSymExprs(se, gNone) { + bool removeParent = false; + bool remove = false; if (se == se->getStmtExpr()) { + remove = true; + } else if (auto call = toCallExpr(se->parentExpr)) { + remove = call->isPrimitive(PRIM_END_OF_STATEMENT); + removeParent = remove && call->numActuals() == 1; + } + if (removeParent) { + se->parentExpr->remove(); + } else if (remove) { se->remove(); } } diff --git a/compiler/resolution/functionResolution.cpp b/compiler/resolution/functionResolution.cpp index 630f38e347ad..b36ee7e97466 100644 --- a/compiler/resolution/functionResolution.cpp +++ b/compiler/resolution/functionResolution.cpp @@ -4417,28 +4417,6 @@ static void resolveNormalCallConstRef(CallExpr* call) { } } -// Returns the element type, given an array type. -static Type* arrayElementType(AggregateType* arrayType) { - Type* eltType = NULL; - INT_ASSERT(arrayType->symbol->hasFlag(FLAG_ARRAY)); - Type* instType = arrayType->getField("_instance")->type; - AggregateType* instClass = toAggregateType(canonicalClassType(instType)); - eltType = instClass->getField("eltType")->getValType(); - return eltType; -} - -// Returns the element type, given an array type. -// Recurse into it if it is still an array. -static Type* finalArrayElementType(AggregateType* arrayType) { - Type* eltType = NULL; - do { - eltType = arrayElementType(arrayType); - arrayType = toAggregateType(eltType); - } while (arrayType != NULL && arrayType->symbol->hasFlag(FLAG_ARRAY)); - - return eltType; -} - // Is it OK to default-initialize an array with this element type? static bool okForDefaultInitializedArray(Type* eltType) { return isDefaultInitializable(eltType); @@ -4497,7 +4475,7 @@ static void checkDefaultNonnilableArrayArg(CallExpr* call, FnSymbol* fn) { ! formal->hasFlag(FLAG_UNSAFE)) if (AggregateType* actualType = toAggregateType(actualSym->getValType())) if (actualType->symbol->hasFlag(FLAG_ARRAY) && - ! okForDefaultInitializedArray(finalArrayElementType(actualType))) + ! okForDefaultInitializedArray(actualType->finalArrayElementType())) // // Acceptable handling of the default actual is this: // def default_arg_xxx: _array(...) @@ -4513,7 +4491,7 @@ static void checkDefaultNonnilableArrayArg(CallExpr* call, FnSymbol* fn) { USR_FATAL_CONT(call, "cannot default-initialize the array field" " %s because it has a non-nilable element type '%s'", userFieldNameForError(actualSym), - toString(finalArrayElementType(actualType), true)); + toString(actualType->finalArrayElementType(), true)); } static void resolveNormalCallFinalChecks(CallExpr* call) { @@ -13075,7 +13053,7 @@ static void lowerRuntimeTypeInit(CallExpr* call, USR_FATAL(call, "noinit is only supported for arrays"); } else if (fAllowNoinitArrayNotPod == false) { // noinit of an array - Type* eltType = arrayElementType(at); + Type* eltType = at->arrayElementType(); bool notPOD = propagateNotPOD(eltType); if (notPOD) { USR_FATAL_CONT(call, "noinit is only supported for arrays of trivially copyable types"); @@ -13444,9 +13422,10 @@ void lowerPrimInit(CallExpr* call, Expr* preventingSplitInit) { name = val->name; } - INT_ASSERT(val->type != dtUnknown && val->type != dtAny); + INT_ASSERT(isAggregateType(val->type)); if (name != NULL) { - Type* eltType = finalArrayElementType(toAggregateType(val->type)); + auto at = toAggregateType(val->type); + Type* eltType = at->finalArrayElementType(); if (! okForDefaultInitializedArray(eltType)) USR_FATAL_CONT(call, "cannot default-initialize the array %s" " because it has a non-nilable element type '%s'", diff --git a/compiler/resolution/resolveFunction.cpp b/compiler/resolution/resolveFunction.cpp index 7cfe0fc96ae1..f990e750f861 100644 --- a/compiler/resolution/resolveFunction.cpp +++ b/compiler/resolution/resolveFunction.cpp @@ -2118,12 +2118,14 @@ void resolveReturnTypeAndYieldedType(FnSymbol* fn, Type** yieldedType) { if (!fn->iteratorInfo) { if (retTypes.n == 0) { if (isIterator) { - // This feels like it should be: - // retType = dtVoid; - // - // but that leads to compiler generated assignments of 'void' to - // variables, which isn't allowed. If we fib and claim that it - // returns 'nothing', those assignments get removed and all is well. + const bool emitError = !fn->hasFlag(FLAG_PROMOTION_WRAPPER); + if (emitError) { + // TODO: Right now this has to be USR_FATAL in order to avoid + // the possibility of subsequent errors about 'nothing'. + USR_FATAL(fn, "iterators with no reachable 'yield' statements " + "must declare their return type"); + } + retType = dtNothing; } else { retType = dtVoid; diff --git a/modules/internal/ChapelArray.chpl b/modules/internal/ChapelArray.chpl index 3b86cee8a840..2e8325811301 100644 --- a/modules/internal/ChapelArray.chpl +++ b/modules/internal/ChapelArray.chpl @@ -935,6 +935,13 @@ module ChapelArray { doiBulkTransferFromAny, doiBulkTransferToAny, chpl__serialize, chpl__deserialize; + // Hook into 'postinit' since arrays do not seem to offer 'init'. + proc postinit() { + if eltType == nothing { + compilerError("cannot initialize array with element type 'nothing'"); + } + } + @chpldoc.nodoc proc deinit() { _do_destroy_array(this); diff --git a/modules/internal/ChapelRange.chpl b/modules/internal/ChapelRange.chpl index 87502f8e0bb5..86310da43ff1 100644 --- a/modules/internal/ChapelRange.chpl +++ b/modules/internal/ChapelRange.chpl @@ -3318,7 +3318,7 @@ private proc isBCPindex(type t) param do // An error overload for trying to iterate over '..' pragma "order independent yielding loops" @chpldoc.nodoc - iter range.these() where !hasLowBoundForIter(this) && !hasHighBoundForIter(this) { + iter range.these(): nothing where !hasLowBoundForIter(this) && !hasHighBoundForIter(this) { compilerError("iteration over a range with no bounds"); } diff --git a/modules/standard/List.chpl b/modules/standard/List.chpl index fe320b9bbbd8..aa3823a48d4c 100644 --- a/modules/standard/List.chpl +++ b/modules/standard/List.chpl @@ -116,6 +116,9 @@ module List { compilerError("list element type cannot currently be generic"); // In the future we might support it if the list is not default-inited } + if eltType == nothing { + compilerError("cannot initialize list with element type 'nothing'"); + } } @chpldoc.nodoc diff --git a/test/errhandling/parallel/forall-iterator-throws-at-end.chpl b/test/errhandling/parallel/forall-iterator-throws-at-end.chpl index d92357a1dbf5..862be67ef937 100644 --- a/test/errhandling/parallel/forall-iterator-throws-at-end.chpl +++ b/test/errhandling/parallel/forall-iterator-throws-at-end.chpl @@ -20,7 +20,7 @@ iter myiter(nn: int, nt: int, param tag: iterKind) throws where tag == iterKind. } // for loop in follower with yield should get vector pragma -iter myiter(nn:int, nt: int, followThis, param tag: iterKind) throws where tag == iterKind.follower { +iter myiter(nn:int, nt: int, followThis, param tag: iterKind): int throws where tag == iterKind.follower { throw new owned StringError("Test error"); } diff --git a/test/errhandling/parallel/forall-iterator-throws-follower.chpl b/test/errhandling/parallel/forall-iterator-throws-follower.chpl index 7b30320ee3da..98329dd1641f 100644 --- a/test/errhandling/parallel/forall-iterator-throws-follower.chpl +++ b/test/errhandling/parallel/forall-iterator-throws-follower.chpl @@ -20,8 +20,10 @@ iter myiter(nn: int, nt: int, param tag: iterKind) throws where tag == iterKind. } // for loop in follower with yield should get vector pragma -iter myiter(nn:int, nt: int, followThis, param tag: iterKind) throws where tag == iterKind.follower { +iter myiter(nn:int, nt: int, followThis, param tag: iterKind): nothing throws where tag == iterKind.follower { throw new owned StringError("Test error"); + // This code is not reachable, so 'yield' does not color return type. Thus + // we say that the iterator returns 'nothing'. for i in followThis { yield i; } diff --git a/test/errhandling/parallel/forall-iterator-throws-setup.chpl b/test/errhandling/parallel/forall-iterator-throws-setup.chpl index d172ebc61056..d172e2189af9 100644 --- a/test/errhandling/parallel/forall-iterator-throws-setup.chpl +++ b/test/errhandling/parallel/forall-iterator-throws-setup.chpl @@ -4,10 +4,11 @@ config const n = 10; config const t = 2; -iter myiter(nn: int, nt: int) throws { +iter myiter(nn: int, nt: int): int throws { throw new owned StringError("Test error"); + // This is not reachable. for i in 0..#nt { for j in i*nn..#nn { yield j; @@ -15,9 +16,10 @@ iter myiter(nn: int, nt: int) throws { } } -iter myiter(nn: int, nt: int, param tag: iterKind) throws where tag == iterKind.standalone { +iter myiter(nn: int, nt: int, param tag: iterKind): int throws where tag == iterKind.standalone { throw new owned StringError("Test error"); + // This is not reachable. coforall i in 0..#nt { for j in i*nn..#nn { yield j; @@ -26,9 +28,10 @@ iter myiter(nn: int, nt: int, param tag: iterKind) throws where tag == iterKind. } // coforall loop in leader should NOT get vector pragma -iter myiter(nn: int, nt: int, param tag: iterKind) throws where tag == iterKind.leader { +iter myiter(nn: int, nt: int, param tag: iterKind): range throws where tag == iterKind.leader { throw new owned StringError("Test error"); + // This is not reachable. coforall i in 0..#nt { yield i*nn..#nn; } diff --git a/test/functions/iterators/Issue21265.1.good b/test/functions/iterators/Issue21265.1.good new file mode 100644 index 000000000000..51ba5ea8be4e --- /dev/null +++ b/test/functions/iterators/Issue21265.1.good @@ -0,0 +1 @@ +Issue21265.chpl:6: error: iterators with no reachable 'yield' statements must declare their return type diff --git a/test/functions/iterators/Issue21265.2.good b/test/functions/iterators/Issue21265.2.good new file mode 100644 index 000000000000..d20b020d0167 --- /dev/null +++ b/test/functions/iterators/Issue21265.2.good @@ -0,0 +1,3 @@ +$CHPL_HOME/modules/standard/List.chpl:204: In initializer: +$CHPL_HOME/modules/standard/List.chpl:205: error: cannot initialize list with element type 'nothing' + Issue21265.chpl:11: called as list.init(type eltType = nothing, param parSafe = false) diff --git a/test/functions/iterators/Issue21265.3.good b/test/functions/iterators/Issue21265.3.good new file mode 100644 index 000000000000..cb458ba89775 --- /dev/null +++ b/test/functions/iterators/Issue21265.3.good @@ -0,0 +1,2 @@ +Issue21265.chpl:14: In function 'test3': +Issue21265.chpl:15: error: cannot initialize array with element type 'nothing' diff --git a/test/functions/iterators/Issue21265.chpl b/test/functions/iterators/Issue21265.chpl new file mode 100644 index 000000000000..bc1296aa9401 --- /dev/null +++ b/test/functions/iterators/Issue21265.chpl @@ -0,0 +1,23 @@ +use List; + +config param case = 1; + +proc test1() { + iter foo() {} + var x = foo(); +} + +proc test2() { + var lst: list(nothing); +} + +proc test3() { + var x: [0..3] nothing; + writeln(x); +} + +proc main() { + if case == 1 then test1(); + if case == 2 then test2(); + if case == 3 then test3(); +} diff --git a/test/functions/iterators/Issue21265.compopts b/test/functions/iterators/Issue21265.compopts new file mode 100644 index 000000000000..564bf1e75b03 --- /dev/null +++ b/test/functions/iterators/Issue21265.compopts @@ -0,0 +1,3 @@ +-scase=1 #Issue21265.1.good +-scase=2 #Issue21265.2.good +-scase=3 #Issue21265.3.good diff --git a/test/functions/iterators/bradc/captureEmpty.bad b/test/functions/iterators/bradc/captureEmpty.bad deleted file mode 100644 index b93c139742e2..000000000000 --- a/test/functions/iterators/bradc/captureEmpty.bad +++ /dev/null @@ -1,7 +0,0 @@ -captureEmpty.chpl:5: internal error: RES-CLE-UPS-nnnn chpl version mmmm - -Internal errors indicate a bug in the Chapel compiler, -and we're sorry for the hassle. We would appreciate your reporting this bug -- -please see https://chapel-lang.org/bugs.html for instructions. In the meantime, -the filename + line number above may be useful in working around the issue. - diff --git a/test/functions/iterators/bradc/captureEmpty.chpl b/test/functions/iterators/bradc/captureEmpty.chpl index 6814b39e0ac6..ba92abd9c786 100644 --- a/test/functions/iterators/bradc/captureEmpty.chpl +++ b/test/functions/iterators/bradc/captureEmpty.chpl @@ -1,4 +1,4 @@ -iter foo() { +iter foo(): nothing { writeln("In foo"); } diff --git a/test/functions/iterators/bradc/captureEmpty.future b/test/functions/iterators/bradc/captureEmpty.future deleted file mode 100644 index a4810e15de52..000000000000 --- a/test/functions/iterators/bradc/captureEmpty.future +++ /dev/null @@ -1,4 +0,0 @@ -bug: capturing yield-less iterators causes compiler segfault - -This test shows that when an iterator with no yields is captured as an -array, we get a segfault in the compiler. \ No newline at end of file diff --git a/test/functions/iterators/bradc/captureEmpty.good b/test/functions/iterators/bradc/captureEmpty.good index 4d08c23ab1e3..bb50373af03d 100644 --- a/test/functions/iterators/bradc/captureEmpty.good +++ b/test/functions/iterators/bradc/captureEmpty.good @@ -1,3 +1 @@ -In foo - -{1..0} +captureEmpty.chpl:5: error: cannot initialize array with element type 'nothing' diff --git a/test/functions/iterators/diten/yieldNothingIterator.chpl b/test/functions/iterators/diten/yieldNothingIterator.chpl index 2ad047b4b5a0..a3c7e5c8df6e 100644 --- a/test/functions/iterators/diten/yieldNothingIterator.chpl +++ b/test/functions/iterators/diten/yieldNothingIterator.chpl @@ -1,4 +1,4 @@ -iter yieldNothing() { +iter yieldNothing(): nothing { writeln("In yieldNothing"); } diff --git a/test/functions/vass/proc-iter/error-no-yield-in-iter-1.chpl b/test/functions/vass/proc-iter/error-no-yield-in-iter-1.chpl index 374d428bbc09..0bc62032f716 100644 --- a/test/functions/vass/proc-iter/error-no-yield-in-iter-1.chpl +++ b/test/functions/vass/proc-iter/error-no-yield-in-iter-1.chpl @@ -1,5 +1,8 @@ -iter i11e() { +iter i11e(): int { writeln("in i11e"); } for i in i11e() do write(i); + +var a = i11e(); +writeln(a); diff --git a/test/functions/vass/proc-iter/error-no-yield-in-iter-1.good b/test/functions/vass/proc-iter/error-no-yield-in-iter-1.good index 3768adaf6f13..55cd5a44c335 100644 --- a/test/functions/vass/proc-iter/error-no-yield-in-iter-1.good +++ b/test/functions/vass/proc-iter/error-no-yield-in-iter-1.good @@ -1 +1,3 @@ in i11e +in i11e + diff --git a/test/npb/ft/npadmana/DistributedFFT.chpl b/test/npb/ft/npadmana/DistributedFFT.chpl index eaf7002c5c50..5ea3dc448646 100644 --- a/test/npb/ft/npadmana/DistributedFFT.chpl +++ b/test/npb/ft/npadmana/DistributedFFT.chpl @@ -340,7 +340,7 @@ prototype module DistributedFFT { Iterate over the range ``r`` but in an offset manner based on the locale id. */ - iter offset(r: range) { halt("Serial offset not implemented"); } + iter offset(r: range): int { halt("Serial offset not implemented"); } @chpldoc.nodoc iter offset(param tag: iterKind, r: range) where (tag==iterKind.standalone) { @@ -391,7 +391,7 @@ prototype module DistributedFFT { this.planLg = setupPlan(arrType, ftType, dom, parDim, batchSizeLg, signOrKind, flags); } - iter batch() { + iter batch(): int { halt("Serial iterator not implemented"); } diff --git a/test/parallel/forall/reduce-intents/ri-iterator-with-on.chpl b/test/parallel/forall/reduce-intents/ri-iterator-with-on.chpl index 55bf98a094e2..72da2b0a2acb 100644 --- a/test/parallel/forall/reduce-intents/ri-iterator-with-on.chpl +++ b/test/parallel/forall/reduce-intents/ri-iterator-with-on.chpl @@ -9,9 +9,8 @@ proc main { writeln(result); } -iter AAA() { +iter AAA(): int { halt("do not invoke me"); - yield 1; } iter AAA(param tag) where tag == iterKind.standalone { diff --git a/test/parallel/forall/vass/other/binary-tree-spawn.no-recurse.chpl b/test/parallel/forall/vass/other/binary-tree-spawn.no-recurse.chpl index 01017a0b5370..fa557e8c8cfb 100644 --- a/test/parallel/forall/vass/other/binary-tree-spawn.no-recurse.chpl +++ b/test/parallel/forall/vass/other/binary-tree-spawn.no-recurse.chpl @@ -13,9 +13,8 @@ proc main { inline proc ln do return 2**here.id; -iter AAA() { +iter AAA(): int { halt("do not invoke me"); - yield 1; } iter AAA(param tag) where tag == iterKind.standalone { diff --git a/test/parallel/forall/vass/other/empty-parallel-iterator.chpl b/test/parallel/forall/vass/other/empty-parallel-iterator.chpl index 0130bd03d32c..dc721fefb29f 100644 --- a/test/parallel/forall/vass/other/empty-parallel-iterator.chpl +++ b/test/parallel/forall/vass/other/empty-parallel-iterator.chpl @@ -1,6 +1,6 @@ -iter badIterator() {} -iter badIterator(param tag : iterKind) where tag == iterKind.standalone { +iter badIterator(): nothing {} +iter badIterator(param tag : iterKind): nothing where tag == iterKind.standalone { writeln("in badIterator"); } diff --git a/test/reductions/standalone/simple.chpl b/test/reductions/standalone/simple.chpl index 4abe5fa40bb4..e5369acfd048 100644 --- a/test/reductions/standalone/simple.chpl +++ b/test/reductions/standalone/simple.chpl @@ -1,6 +1,6 @@ // This program used to produce the incorrect result (count == 0 instead of 5) // when the standalone iterator (incorrectly) had the 'ref' return intent -iter myIter() { +iter myIter(): int { halt("Dummy serial iterator"); } diff --git a/test/reductions/standalone/tupleIterator.chpl b/test/reductions/standalone/tupleIterator.chpl index 7ad7ce8517e5..9fa386d99a5e 100644 --- a/test/reductions/standalone/tupleIterator.chpl +++ b/test/reductions/standalone/tupleIterator.chpl @@ -1,5 +1,5 @@ // This program used used to not compile due to assertion error in [implementForallIntents.cpp:1125] -iter myIter() { +iter myIter(): 2*int { halt("Dummy serial iterator"); } diff --git a/test/studies/ssca2/main/SSCA2_Modules/io_RMAT_graph.chpl b/test/studies/ssca2/main/SSCA2_Modules/io_RMAT_graph.chpl index 1dceaf45b58e..0399c2a7bb70 100644 --- a/test/studies/ssca2/main/SSCA2_Modules/io_RMAT_graph.chpl +++ b/test/studies/ssca2/main/SSCA2_Modules/io_RMAT_graph.chpl @@ -267,10 +267,8 @@ var IOgateSync: sync bool; // But it is not implemented. Use --IOserial instead. // iter graphReaderIterator(GRow, uxIDs, type VType, vCount, eCount, repfiles, - dON, dRow, dEdge, dstyle) { + dON, dRow, dEdge, dstyle): VType { halt("serial graphReaderIterator should not be invoked"); - yield 0:VType; - } // This is the follower iterator.