diff options
author | Araq <rumpf_a@web.de> | 2018-08-13 23:16:03 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2018-08-13 23:16:03 +0200 |
commit | f91a181f58acfa7c75e4683e582455c98bc8693d (patch) | |
tree | effd60801042c890188135337556e70eceaf16d7 /tests/notnil | |
parent | a0cde8cee6fab6983b18562faa016bb340b6b0a7 (diff) | |
download | Nim-f91a181f58acfa7c75e4683e582455c98bc8693d.tar.gz |
make tests green again
Diffstat (limited to 'tests/notnil')
-rw-r--r-- | tests/notnil/tmust_compile.nim | 20 | ||||
-rw-r--r-- | tests/notnil/tnotnil1.nim | 15 | ||||
-rw-r--r-- | tests/notnil/tnotnil_in_objconstr.nim | 8 |
3 files changed, 8 insertions, 35 deletions
diff --git a/tests/notnil/tmust_compile.nim b/tests/notnil/tmust_compile.nim index a32c6c7ec..d09dda057 100644 --- a/tests/notnil/tmust_compile.nim +++ b/tests/notnil/tmust_compile.nim @@ -44,16 +44,16 @@ import json type foo = object - thing: string not nil + thing: ptr int not nil CTS = ref object subs_by_sid: Table[int, foo] proc parse(cts: CTS, jn: JsonNode) = - + var y = jn.getInt(4523) let ces = foo( - thing: jn.getStr("thing") + thing: addr y ) cts.subs_by_sid[0] = ces @@ -63,17 +63,3 @@ proc parse(cts: CTS, jn: JsonNode) = proc p(x: proc(){.closure.} not nil) = discard p(proc(){.closure.} = discard) - -# bug #3993 - -type - List[T] = seq[T] not nil - -proc `^^`[T](v: T, lst: List[T]): List[T] = - result = @[v] - result.add(lst) - -proc Nil[T](): List[T] = @[] - -when isMainModule: - let lst = 1 ^^ 2 ^^ Nil[int]() diff --git a/tests/notnil/tnotnil1.nim b/tests/notnil/tnotnil1.nim index 7f9d02295..60666d64d 100644 --- a/tests/notnil/tnotnil1.nim +++ b/tests/notnil/tnotnil1.nim @@ -1,6 +1,6 @@ discard """ errormsg: "'y' is provably nil" - line:38 + line:25 """ import strutils @@ -10,19 +10,6 @@ type TObj = object x, y: int -type - superstring = string not nil - - -proc q(s: superstring) = - echo s - -proc p2() = - var a: string = "I am not nil" - q(a) # but this should and does not - -p2() - proc q(x: pointer not nil) = discard diff --git a/tests/notnil/tnotnil_in_objconstr.nim b/tests/notnil/tnotnil_in_objconstr.nim index d33709906..f0d5c1ae2 100644 --- a/tests/notnil/tnotnil_in_objconstr.nim +++ b/tests/notnil/tnotnil_in_objconstr.nim @@ -6,9 +6,9 @@ discard """ # bug #2355 type Foo = object - foo: string not nil - bar: string not nil - + foo: ref int + bar: ref int not nil +var x: ref int = new(int) # Create instance without initializaing the `bar` field -var f = Foo(foo: "foo") +var f = Foo(foo: x) echo f.bar.isNil # true |