parent
daefc2567b
commit
e55f5d1fd4
10 changed files with 58 additions and 11 deletions
|
|
@ -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]()
|
||||
|
||||
|
|
@ -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]
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue