summary refs log tree commit diff stats
path: root/tests/generics/tgenericsdefaultvalues.nim
blob: 2604c103121d8138730ea7f1cab237c1f73bb2ce (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
discard """
output: "12"
"""

# https://github.com/nim-lang/Nim/issues/5864

proc defaultStatic(s: openarray, N: static[int] = 1): int = N
proc defaultGeneric[T](a: T = 2): int = a

let a = [1, 2, 3, 4].defaultStatic()
let b = defaultGeneric()

echo a, b