summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2020-03-05 16:02:34 +0100
committerGitHub <noreply@github.com>2020-03-05 16:02:34 +0100
commit83e715c5b6b2501c02459398a2f394c457758a55 (patch)
tree2855c11dba5742de851dab4935881e03467b49ed /tests
parent62c113ebc7ba6fa1594b24158a6cc3e1170f4030 (diff)
downloadNim-83e715c5b6b2501c02459398a2f394c457758a55.tar.gz
fixes #5170 (#13589)
* fixes #5170

* make tests green
Diffstat (limited to 'tests')
-rw-r--r--tests/errmsgs/tsigmatch.nim6
-rw-r--r--tests/errmsgs/tsigmatch2.nim4
-rw-r--r--tests/types/tissues_types.nim30
3 files changed, 35 insertions, 5 deletions
diff --git a/tests/errmsgs/tsigmatch.nim b/tests/errmsgs/tsigmatch.nim
index 21e2c217d..6b85d1408 100644
--- a/tests/errmsgs/tsigmatch.nim
+++ b/tests/errmsgs/tsigmatch.nim
@@ -98,13 +98,13 @@ expression: fun1(default(Mystring), "asdf")
 
 
 ## line 100
-block:
+when true:
   # bug #11061 Type mismatch error "first type mismatch at" points to wrong argument/position
   # Note: the error msg now gives correct position for mismatched argument
   type
     A = object of RootObj
     B = object of A
-
+block:
   proc f(b: B) = discard
   proc f(a: A) = discard
 
@@ -163,7 +163,7 @@ block:
   var foo = ""
   f(foo, a0 = 12)
 
-block:
+when true:
   type Mystring = string
   type MyInt = int
   proc fun1(a1: MyInt, a2: Mystring) = discard
diff --git a/tests/errmsgs/tsigmatch2.nim b/tests/errmsgs/tsigmatch2.nim
index c4eb4c197..4e95d3e1b 100644
--- a/tests/errmsgs/tsigmatch2.nim
+++ b/tests/errmsgs/tsigmatch2.nim
@@ -28,11 +28,11 @@ expression: foo 1
 
 
 # line 30
-
+type Foo = object
 block: # issue #13182
   proc myproc(a: int): string = $("myproc", a)
   proc foo(args: varargs[string, myproc]): string = $args
-  type Foo = object
+
   proc foo(i: Foo): string = "in foo(i)"
   static: doAssert foo(Foo()) == "in foo(i)"
   static: doAssert foo(1) == """["(\"myproc\", 1)"]"""
diff --git a/tests/types/tissues_types.nim b/tests/types/tissues_types.nim
index e5039fa61..7ed0547bf 100644
--- a/tests/types/tissues_types.nim
+++ b/tests/types/tissues_types.nim
@@ -8,6 +8,8 @@ ptr Foo
 (member: 123.456)
 (member: "hello world", x: ...)
 (member: 123.456, x: ...)
+0
+false
 '''
 joinable: false
 """
@@ -78,3 +80,31 @@ block t7905:
 
   foobarRec("hello world")
   foobarRec(123.456'f64)
+
+# bug #5170
+
+when true:
+  type Foo = object
+    bar: bool
+
+  type Bar = object
+    sameBody: string
+
+  var b0: Bar
+  b0.sameBody = "abc"
+
+block:
+  type Foo = object
+    baz: int
+
+  type Bar = object
+    sameBody: string
+
+  var b1: Bar
+  b1.sameBody = "def"
+
+  var f2: Foo
+  echo f2.baz
+
+var f1: Foo
+echo f1.bar