diff options
author | LemonBoy <LemonBoy@users.noreply.github.com> | 2018-08-22 09:40:31 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2018-08-22 09:40:31 +0200 |
commit | a87341775aa424f252e9e17d58119b0758b58693 (patch) | |
tree | 86a2ba9d2936c65d7fc16d58a9c2198bd36955f6 /tests/magics | |
parent | 3e7aaa70878d6eda0dfb2737243efae6daa6e26c (diff) | |
download | Nim-a87341775aa424f252e9e17d58119b0758b58693.tar.gz |
Don't consider tyAnd/tyNot/tyOr/tyAnything as generic (#8700)
* Don't consider tyAnd/tyNot/tyOr/tyAnything as generic `containsGenericType` was too shallow and didn't check all the branches. The resulting half-processed nodes are often simplified by the constant folding pass but when that's not possible we get a nasty error during codegen. Fixes #8693 * Move the blame onto the semFold pass Slightly better evaluation of `is` forms.
Diffstat (limited to 'tests/magics')
-rw-r--r-- | tests/magics/t8693.nim | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/magics/t8693.nim b/tests/magics/t8693.nim new file mode 100644 index 000000000..554244de4 --- /dev/null +++ b/tests/magics/t8693.nim @@ -0,0 +1,29 @@ +discard """ + output: '''true +false +true +false +false +true +true +false +true +true +''' +""" + +type Foo = int | float + +proc bar(t1, t2: typedesc): bool = + echo (t1 is t2) + (t2 is t1) + +proc bar[T](x: T, t2: typedesc): bool = + echo (T is t2) + (t2 is T) + +echo bar(int, Foo) +echo bar(4, Foo) +echo bar(any, int) +echo bar(int, any) +echo bar(Foo, Foo) |