-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Description
let theEnvironment = "default-env"
proc foobar_internal(env: string; arg: int): void =
echo "form ", env, " called foobar with arg: ", arg
template foobar(arg: int): void =
mixin theEnvironment
foobar_internal(theEnvironment, arg)
foobar(1)
proc main(): void =
let theEnvironment = "local-env"
foobar(2)
main()compilation error:
nim c -r /tmp/scratch.nim
Hint: used config file '/home/arne/proj/nim/Nim/config/nim.cfg' [Conf]
Hint: system [Processing]
Hint: scratch [Processing]
scratch.nim(11, 7) Error: type mismatch: got <string, int literal(1)>
but expected one of:
proc foobar_internal(env: string; arg: int): void
first type mismatch at position: 1
required type: string
but expression 'theEnvironment' is of type: None
expression: foobar_internal(theEnvironment, 1)
In the error it tells me that the first argument is of type string, but then later it tells it is of type None. That cannot be right.