diff options
author | Ico Doornekamp <ico@pruts.nl> | 2019-05-20 15:22:42 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2019-05-20 15:22:42 +0200 |
commit | c01f7bfdaf674a6e1e8be32b6731aee3275fe19f (patch) | |
tree | 7cbe6a50f7bbe9f8d0383b29d57744e380ccb5ff | |
parent | aeb6ec27dec21509eebf5aa1a78b82b184117450 (diff) | |
download | Nim-c01f7bfdaf674a6e1e8be32b6731aee3275fe19f.tar.gz |
More specific error message for unsupported recursion in iterators (#11283)
-rw-r--r-- | compiler/semexprs.nim | 2 | ||||
-rw-r--r-- | compiler/semstmts.nim | 1 | ||||
-rw-r--r-- | tests/iter/treciter.nim | 2 |
3 files changed, 3 insertions, 2 deletions
diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index db26e385d..6261efaaa 100644 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -804,7 +804,7 @@ proc semOverloadedCallAnalyseEffects(c: PContext, n: PNode, nOrig: PNode, of skMacro, skTemplate: discard else: if callee.kind == skIterator and callee.id == c.p.owner.id: - localError(c.config, n.info, errRecursiveDependencyX % callee.name.s) + localError(c.config, n.info, errRecursiveDependencyIteratorX % callee.name.s) # error correction, prevents endless for loop elimination in transf. # See bug #2051: result.sons[0] = newSymNode(errorSym(c, n)) diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim index 935934962..7f0910429 100644 --- a/compiler/semstmts.nim +++ b/compiler/semstmts.nim @@ -34,6 +34,7 @@ const errThreadvarCannotInit = "a thread var cannot be initialized explicitly; this would only run for the main thread" errImplOfXexpected = "implementation of '$1' expected" errRecursiveDependencyX = "recursive dependency: '$1'" + errRecursiveDependencyIteratorX = "recursion is not supported in iterators: '$1'" errPragmaOnlyInHeaderOfProcX = "pragmas are only allowed in the header of a proc; redefinition of $1" errCannotAssignMacroSymbol = "cannot assign macro symbol to $1 here. Forgot to invoke the macro with '()'?" errInvalidTypeDescAssign = "'typedesc' metatype is not valid here; typed '=' instead of ':'?" diff --git a/tests/iter/treciter.nim b/tests/iter/treciter.nim index 7b61326f4..11fb58224 100644 --- a/tests/iter/treciter.nim +++ b/tests/iter/treciter.nim @@ -1,5 +1,5 @@ discard """ - errormsg: "recursive dependency: \'myrec\'" + errormsg: "recursion is not supported in iterators: 'myrec'" file: "treciter.nim" line: 9 """ |