diff options
author | Arne Döring <arne.doering@gmx.net> | 2019-10-11 08:43:58 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2019-10-11 08:43:58 +0200 |
commit | 7cf3395d857d2e05fb3a83dc67173a69c828807f (patch) | |
tree | a965c85256ed00c23375fec7f49c3408b2b0ac9f /tests/errmsgs | |
parent | 245a954b250b3e95f68c6bdadeba6ef1425442aa (diff) | |
download | Nim-7cf3395d857d2e05fb3a83dc67173a69c828807f.tar.gz |
refactor illegal iterator assignment detection (#12212)
* refactor illegal iterator assignment detection * delete crappy test
Diffstat (limited to 'tests/errmsgs')
-rw-r--r-- | tests/errmsgs/ttypeAllowed.nim | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/errmsgs/ttypeAllowed.nim b/tests/errmsgs/ttypeAllowed.nim new file mode 100644 index 000000000..a5b335faa --- /dev/null +++ b/tests/errmsgs/ttypeAllowed.nim @@ -0,0 +1,28 @@ +discard """ +cmd: "nim check $file" +errmsg: "" +nimout: ''' +ttypeAllowed.nim(13, 5) Error: invalid type: 'iterator (a: int, b: int, step: Positive): int{.inline, noSideEffect, gcsafe, locks: 0.}' for let +ttypeAllowed.nim(17, 7) Error: invalid type for const: iterator (a: int, b: int, step: Positive): int{.inline, noSideEffect, gcsafe, locks: 0.} +ttypeAllowed.nim(21, 5) Error: invalid type: 'iterator (a: int, b: int, step: Positive): int{.inline, noSideEffect, gcsafe, locks: 0.}' for var +ttypeAllowed.nim(26, 10) Error: invalid type: 'iterator (a: int, b: int, step: Positive): int{.inline, noSideEffect, gcsafe, locks: 0.}' for result +''' +""" + + +let f1 = case true + of true: countup[int] + of false: countdown[int] + +const f2 = case true + of true: countup[int] + of false: countdown[int] + +var f3 = case true + of true: countup[int] + of false: countdown[int] + +proc foobar(): auto = + result = case true + of true: countup[int] + of false: countdown[int] |