diff options
author | Araq <rumpf_a@web.de> | 2015-04-20 21:25:49 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2015-04-20 21:25:49 +0200 |
commit | e55f5d1fd4111c2112ef9139d776b23dd7a45497 (patch) | |
tree | a2ca3792b1f7fa808e79bd84157c919be700e715 /tests | |
parent | daefc2567b267182cfd29982594583b4627be54b (diff) | |
download | Nim-e55f5d1fd4111c2112ef9139d776b23dd7a45497.tar.gz |
fixes #2505, fixes #1853, fixes #2522
Diffstat (limited to 'tests')
-rw-r--r-- | tests/cpp/tget_subsystem.nim (renamed from tests/cpp/get_subsystem.nim) | 3 | ||||
-rw-r--r-- | tests/cpp/tvector_iterator.nim (renamed from tests/cpp/vector_iterator.nim) | 0 | ||||
-rw-r--r-- | tests/macros/typesapi2.nim | 4 | ||||
-rw-r--r-- | tests/types/tisopr.nim | 41 |
4 files changed, 43 insertions, 5 deletions
diff --git a/tests/cpp/get_subsystem.nim b/tests/cpp/tget_subsystem.nim index 38593b03a..461914739 100644 --- a/tests/cpp/get_subsystem.nim +++ b/tests/cpp/tget_subsystem.nim @@ -16,7 +16,8 @@ struct SystemManager { """.} type Input {.importcpp: "System::Input".} = object -proc getSubsystem*[T](): ptr T {.importcpp: "SystemManager::getSubsystem<'*0>()".} +proc getSubsystem*[T](): ptr T {. + importcpp: "SystemManager::getSubsystem<'*0>()", nodecl.} let input: ptr Input = getSubsystem[Input]() diff --git a/tests/cpp/vector_iterator.nim b/tests/cpp/tvector_iterator.nim index cb5ab33af..cb5ab33af 100644 --- a/tests/cpp/vector_iterator.nim +++ b/tests/cpp/tvector_iterator.nim diff --git a/tests/macros/typesapi2.nim b/tests/macros/typesapi2.nim index 016295ba4..2e59d2154 100644 --- a/tests/macros/typesapi2.nim +++ b/tests/macros/typesapi2.nim @@ -1,4 +1,4 @@ -# tests to see if a symbol returned from macros.getType() can +# tests to see if a symbol returned from macros.getType() can # be used as a type import macros @@ -20,7 +20,7 @@ static: assert iii is TestFN proc foo11 : testTypesym(void) = echo "HI!" -static: assert foo11 is proc():void +static: assert foo11 is (proc():void {.nimcall.}) var sss: testTypesym(seq[int]) static: assert sss is seq[int] diff --git a/tests/types/tisopr.nim b/tests/types/tisopr.nim index 8b7fe4e46..b9acfa5fb 100644 --- a/tests/types/tisopr.nim +++ b/tests/types/tisopr.nim @@ -1,5 +1,11 @@ discard """ - output: '''true true false yes''' + output: '''true true false yes +false +false +false +true +true +no''' """ proc IsVoid[T](): string = @@ -28,7 +34,7 @@ no s.items is iterator: float yes s.items is iterator: TNumber no s.items is iterator: object -type +type Iter[T] = iterator: T yes s.items is Iter[TNumber] @@ -51,3 +57,34 @@ yes Foo[4, int] is Bar[int] no Foo[4, int] is Baz[4] yes Foo[4, float] is Baz[4] + +# bug #2505 + +echo(8'i8 is int32) + +# bug #1853 +type SeqOrSet[E] = seq[E] or set[E] +type SeqOfInt = seq[int] +type SeqOrSetOfInt = SeqOrSet[int] + +# This prints "false", which seems less correct that (1) printing "true" or (2) +# raising a compiler error. +echo seq is SeqOrSet + +# This prints "false", as expected. +echo seq is SeqOrSetOfInt + +# This prints "true", as expected. +echo SeqOfInt is SeqOrSet + +# This causes an internal error (filename: compiler/semtypes.nim, line: 685). +echo SeqOfInt is SeqOrSetOfInt + +# bug #2522 +proc test[T](x: T) = + when T is typedesc: + echo "yes" + else: + echo "no" + +test(7) |