summary refs log tree commit diff stats
path: root/tests/errmsgs/tundeclared_routine.nim
diff options
context:
space:
mode:
authorTimothee Cour <timothee.cour2@gmail.com>2021-04-27 01:42:24 -0700
committerGitHub <noreply@github.com>2021-04-27 10:42:24 +0200
commit93c26041a5484373512069512471bbde943a7242 (patch)
tree1969ea8a6b542288b59591a7a4d5b98ed0635fee /tests/errmsgs/tundeclared_routine.nim
parentb1c7c994b0bcd39776fce16bdda24358f1fbb0d4 (diff)
downloadNim-93c26041a5484373512069512471bbde943a7242.tar.gz
fix #17859; rename tests so they run in CI; merge several tests with nim check (#17862)
* rename a test so it runs in CI; merge several tests with nim check

* continue

* continue

* continue

* rename tests/errmsgs/undeclared_routine_compiles.nim -> tests/errmsgs/tundeclared_routine_compiles.nim
Diffstat (limited to 'tests/errmsgs/tundeclared_routine.nim')
-rw-r--r--tests/errmsgs/tundeclared_routine.nim44
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/errmsgs/tundeclared_routine.nim b/tests/errmsgs/tundeclared_routine.nim
new file mode 100644
index 000000000..2f1320fff
--- /dev/null
+++ b/tests/errmsgs/tundeclared_routine.nim
@@ -0,0 +1,44 @@
+discard """
+cmd: '''nim check --hints:off $file'''
+action: reject
+nimout: '''
+tundeclared_routine.nim(24, 17) Error: attempting to call routine: 'myiter'
+  found tundeclared_routine.myiter(a: string) [iterator declared in tundeclared_routine.nim(22, 12)]
+  found tundeclared_routine.myiter() [iterator declared in tundeclared_routine.nim(23, 12)]
+tundeclared_routine.nim(29, 28) Error: invalid pragma: myPragma
+tundeclared_routine.nim(36, 13) Error: undeclared field: 'bar3' for type tundeclared_routine.Foo [type declared in tundeclared_routine.nim(33, 8)]
+  found tundeclared_routine.bar3() [iterator declared in tundeclared_routine.nim(35, 12)]
+tundeclared_routine.nim(41, 13) Error: undeclared field: 'bar4' for type tundeclared_routine.Foo [type declared in tundeclared_routine.nim(39, 8)]
+tundeclared_routine.nim(44, 15) Error: attempting to call routine: 'bad5'
+'''
+"""
+
+
+
+
+
+# line 20
+block:
+  iterator myiter(a:string): int = discard
+  iterator myiter(): int = discard
+  let a = myiter(1)
+
+block:
+  proc myPragma():int=discard
+  iterator myPragma():int=discard
+  proc myfun(a:int): int {.myPragma.} = 1
+  let a = myfun(1)
+
+block:
+  type Foo = object
+  var a = Foo()
+  iterator bar3():int=discard
+  let a2 = a.bar3
+
+block:
+  type Foo = object
+  var a = Foo()
+  let a2 = a.bar4
+
+block:
+  let a = bad5(1)