diff options
Diffstat (limited to 'nimpretty')
-rw-r--r-- | nimpretty/tests/exhaustive.nim | 23 | ||||
-rw-r--r-- | nimpretty/tests/expected/exhaustive.nim | 23 |
2 files changed, 46 insertions, 0 deletions
diff --git a/nimpretty/tests/exhaustive.nim b/nimpretty/tests/exhaustive.nim index 2f8fe03f2..8280420c5 100644 --- a/nimpretty/tests/exhaustive.nim +++ b/nimpretty/tests/exhaustive.nim @@ -409,3 +409,26 @@ type ccFastCall, # fastcall (pass parameters in registers) ccClosure, # proc has a closure ccNoConvention # needed for generating proper C procs sometimes + + +proc isValid1*[A](s: HashSet[A]): bool {.deprecated: + "Deprecated since v0.20; sets are initialized by default".} = + ## Returns `true` if the set has been initialized (with `initHashSet proc + ## <#initHashSet,int>`_ or `init proc <#init,HashSet[A],int>`_). + result = s.data.len > 0 + # bug #11468 + +assert $type(a) == "Option[system.int]" +foo(a, $type(b), c) +foo(type(b), c) # this is ok + +proc `<`*[A](s, t: A): bool = discard +proc `==`*[A](s, t: HashSet[A]): bool = discard +proc `<=`*[A](s, t: HashSet[A]): bool = discard + +# these are ok: +proc `$`*[A](s: HashSet[A]): string = discard +proc `*`*[A](s1, s2: HashSet[A]): HashSet[A] {.inline.} = discard +proc `-+-`*[A](s1, s2: HashSet[A]): HashSet[A] {.inline.} = discard + +# bug #11470 diff --git a/nimpretty/tests/expected/exhaustive.nim b/nimpretty/tests/expected/exhaustive.nim index 75580081d..4e90faa25 100644 --- a/nimpretty/tests/expected/exhaustive.nim +++ b/nimpretty/tests/expected/exhaustive.nim @@ -419,3 +419,26 @@ type ccFastCall, # fastcall (pass parameters in registers) ccClosure, # proc has a closure ccNoConvention # needed for generating proper C procs sometimes + + +proc isValid1*[A](s: HashSet[A]): bool {.deprecated: + "Deprecated since v0.20; sets are initialized by default".} = + ## Returns `true` if the set has been initialized (with `initHashSet proc + ## <#initHashSet,int>`_ or `init proc <#init,HashSet[A],int>`_). + result = s.data.len > 0 + # bug #11468 + +assert $type(a) == "Option[system.int]" +foo(a, $type(b), c) +foo(type(b), c) # this is ok + +proc `<`*[A](s, t: A): bool = discard +proc `==`*[A](s, t: HashSet[A]): bool = discard +proc `<=`*[A](s, t: HashSet[A]): bool = discard + +# these are ok: +proc `$`*[A](s: HashSet[A]): string = discard +proc `*`*[A](s1, s2: HashSet[A]): HashSet[A] {.inline.} = discard +proc `-+-`*[A](s1, s2: HashSet[A]): HashSet[A] {.inline.} = discard + +# bug #11470 |