From 0b143db8a5dc31881d7dd08785332d5dde59f953 Mon Sep 17 00:00:00 2001 From: Timothee Cour Date: Mon, 26 Apr 2021 13:10:48 -0700 Subject: [PATCH 1/5] rename a test so it runs in CI; merge several tests with nim check --- tests/errmsgs/tundeclared_routine.nim | 30 +++++++++++++++++++++++++++ tests/errmsgs/undeclared_routine.nim | 13 ------------ tests/errmsgs/undeclared_routine2.nim | 9 -------- 3 files changed, 30 insertions(+), 22 deletions(-) create mode 100644 tests/errmsgs/tundeclared_routine.nim delete mode 100644 tests/errmsgs/undeclared_routine.nim delete mode 100644 tests/errmsgs/undeclared_routine2.nim diff --git a/tests/errmsgs/tundeclared_routine.nim b/tests/errmsgs/tundeclared_routine.nim new file mode 100644 index 000000000000..1569d0dc22b9 --- /dev/null +++ b/tests/errmsgs/tundeclared_routine.nim @@ -0,0 +1,30 @@ +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 +''' +""" + + + + + + + + + +# 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) diff --git a/tests/errmsgs/undeclared_routine.nim b/tests/errmsgs/undeclared_routine.nim deleted file mode 100644 index 126ade52ae40..000000000000 --- a/tests/errmsgs/undeclared_routine.nim +++ /dev/null @@ -1,13 +0,0 @@ -discard """ -cmd: '''nim c --hints:off $file''' -errormsg: "attempting to call routine: 'myiter'" -nimout: '''undeclared_routine.nim(13, 15) Error: attempting to call routine: 'myiter' - found 'undeclared_routine.myiter(a: string)[iterator declared in undeclared_routine.nim(10, 9)]' - found 'undeclared_routine.myiter()[iterator declared in undeclared_routine.nim(11, 9)]' -''' -""" - -iterator myiter(a:string): int = discard -iterator myiter(): int = discard - -let a = myiter(1) diff --git a/tests/errmsgs/undeclared_routine2.nim b/tests/errmsgs/undeclared_routine2.nim deleted file mode 100644 index 3e48b48f4cd4..000000000000 --- a/tests/errmsgs/undeclared_routine2.nim +++ /dev/null @@ -1,9 +0,0 @@ -discard """ -cmd: '''nim c --hints:off $file''' -errormsg: "invalid pragma: myPragma" -""" - -proc myPragma():int=discard -iterator myPragma():int=discard -proc myfun(a:int): int {.myPragma.} = 1 -let a = myfun(1) From ad3191fdb76b8389d3aec74e0044d8a7bc8875c8 Mon Sep 17 00:00:00 2001 From: Timothee Cour Date: Mon, 26 Apr 2021 13:13:55 -0700 Subject: [PATCH 2/5] continue --- tests/errmsgs/tundeclared_routine.nim | 10 ++++++++-- tests/errmsgs/undeclared_routine3.nim | 13 ------------- 2 files changed, 8 insertions(+), 15 deletions(-) delete mode 100644 tests/errmsgs/undeclared_routine3.nim diff --git a/tests/errmsgs/tundeclared_routine.nim b/tests/errmsgs/tundeclared_routine.nim index 1569d0dc22b9..e3047647c69b 100644 --- a/tests/errmsgs/tundeclared_routine.nim +++ b/tests/errmsgs/tundeclared_routine.nim @@ -6,6 +6,8 @@ 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: 'bar' for type tundeclared_routine.Foo [type declared in tundeclared_routine.nim(33, 8)] + found tundeclared_routine.bar() [iterator declared in tundeclared_routine.nim(35, 12)] ''' """ @@ -15,8 +17,6 @@ tundeclared_routine.nim(29, 28) Error: invalid pragma: myPragma - - # line 20 block: iterator myiter(a:string): int = discard @@ -28,3 +28,9 @@ block: iterator myPragma():int=discard proc myfun(a:int): int {.myPragma.} = 1 let a = myfun(1) + +block: + type Foo = object + var a = Foo() + iterator bar():int=discard + let a2 = a.bar diff --git a/tests/errmsgs/undeclared_routine3.nim b/tests/errmsgs/undeclared_routine3.nim deleted file mode 100644 index 537871900883..000000000000 --- a/tests/errmsgs/undeclared_routine3.nim +++ /dev/null @@ -1,13 +0,0 @@ -discard """ -cmd: '''nim c --hints:off $file''' -errormsg: "undeclared field: 'bar'" -nimout: '''undeclared_routine3.nim(13, 10) Error: undeclared field: 'bar' - found 'undeclared_routine3.bar()[declared in undeclared_routine3.nim(12, 9)]' of kind 'iterator' -''' -""" - - -type Foo = object -var a = Foo() -iterator bar():int=discard -let a = a.bar From da32940d3c13f5779c53feb50c4fec1c03eb99c5 Mon Sep 17 00:00:00 2001 From: Timothee Cour Date: Mon, 26 Apr 2021 13:19:12 -0700 Subject: [PATCH 3/5] continue --- tests/errmsgs/tundeclared_routine.nim | 15 ++++++++++----- tests/errmsgs/undeclared_routine4.nim | 10 ---------- 2 files changed, 10 insertions(+), 15 deletions(-) delete mode 100644 tests/errmsgs/undeclared_routine4.nim diff --git a/tests/errmsgs/tundeclared_routine.nim b/tests/errmsgs/tundeclared_routine.nim index e3047647c69b..62c53828d72d 100644 --- a/tests/errmsgs/tundeclared_routine.nim +++ b/tests/errmsgs/tundeclared_routine.nim @@ -6,8 +6,9 @@ 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: 'bar' for type tundeclared_routine.Foo [type declared in tundeclared_routine.nim(33, 8)] - found tundeclared_routine.bar() [iterator declared in tundeclared_routine.nim(35, 12)] +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)] ''' """ @@ -16,7 +17,6 @@ tundeclared_routine.nim(36, 13) Error: undeclared field: 'bar' for type tundecla - # line 20 block: iterator myiter(a:string): int = discard @@ -32,5 +32,10 @@ block: block: type Foo = object var a = Foo() - iterator bar():int=discard - let a2 = a.bar + iterator bar3():int=discard + let a2 = a.bar3 + +block: + type Foo = object + var a = Foo() + let a2 = a.bar4 diff --git a/tests/errmsgs/undeclared_routine4.nim b/tests/errmsgs/undeclared_routine4.nim deleted file mode 100644 index 9012a983f360..000000000000 --- a/tests/errmsgs/undeclared_routine4.nim +++ /dev/null @@ -1,10 +0,0 @@ -discard """ -cmd: '''nim c --hints:off $file''' -errormsg: "undeclared field: 'bar'" -nimout: '''undeclared_routine4.nim(10, 10) Error: undeclared field: 'bar' -''' -""" - -type Foo = object -var a = Foo() -let a = a.bar From 0f70d2fc9015266df51a54aff42f7d12df8190f8 Mon Sep 17 00:00:00 2001 From: Timothee Cour Date: Mon, 26 Apr 2021 13:21:33 -0700 Subject: [PATCH 4/5] continue --- tests/errmsgs/tundeclared_routine.nim | 5 ++++- tests/errmsgs/undeclared_routine5.nim | 9 --------- 2 files changed, 4 insertions(+), 10 deletions(-) delete mode 100644 tests/errmsgs/undeclared_routine5.nim diff --git a/tests/errmsgs/tundeclared_routine.nim b/tests/errmsgs/tundeclared_routine.nim index 62c53828d72d..2f1320fff51a 100644 --- a/tests/errmsgs/tundeclared_routine.nim +++ b/tests/errmsgs/tundeclared_routine.nim @@ -9,6 +9,7 @@ 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' ''' """ @@ -16,7 +17,6 @@ tundeclared_routine.nim(41, 13) Error: undeclared field: 'bar4' for type tundecl - # line 20 block: iterator myiter(a:string): int = discard @@ -39,3 +39,6 @@ block: type Foo = object var a = Foo() let a2 = a.bar4 + +block: + let a = bad5(1) diff --git a/tests/errmsgs/undeclared_routine5.nim b/tests/errmsgs/undeclared_routine5.nim deleted file mode 100644 index 0387448a4b78..000000000000 --- a/tests/errmsgs/undeclared_routine5.nim +++ /dev/null @@ -1,9 +0,0 @@ -discard """ -cmd: '''nim c --hints:off $file''' -errormsg: "undeclared identifier: 'myfun'" -nimout: '''undeclared_routine5.nim(9, 9) Error: undeclared identifier: 'myfun' -''' -""" - - -let a = myfun(1) From faf90eff34b3dd7b5a3f1899da437897bab9fa80 Mon Sep 17 00:00:00 2001 From: Timothee Cour Date: Mon, 26 Apr 2021 13:23:19 -0700 Subject: [PATCH 5/5] rename tests/errmsgs/undeclared_routine_compiles.nim -> tests/errmsgs/tundeclared_routine_compiles.nim --- ...ared_routine_compiles.nim => tundeclared_routine_compiles.nim} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/errmsgs/{undeclared_routine_compiles.nim => tundeclared_routine_compiles.nim} (100%) diff --git a/tests/errmsgs/undeclared_routine_compiles.nim b/tests/errmsgs/tundeclared_routine_compiles.nim similarity index 100% rename from tests/errmsgs/undeclared_routine_compiles.nim rename to tests/errmsgs/tundeclared_routine_compiles.nim