mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-31 02:12:11 +00:00
36 lines
727 B
Nim
36 lines
727 B
Nim
discard """
|
|
nimout: '''
|
|
compile start
|
|
tused.nim(15, 8) Hint: 'tused.echoSub(a: int, b: int)[declared in tused.nim(15, 7)]' is declared but not used [XDeclaredButNotUsed]
|
|
compile end'''
|
|
output: "8\n8"
|
|
"""
|
|
|
|
static:
|
|
echo "compile start"
|
|
|
|
template implementArithOpsOld(T) =
|
|
proc echoAdd(a, b: T) =
|
|
echo a + b
|
|
proc echoSub(a, b: T) =
|
|
echo a - b
|
|
|
|
template implementArithOpsNew(T) =
|
|
proc echoAdd(a, b: T) {.used.} =
|
|
echo a + b
|
|
proc echoSub(a, b: T) {.used.} =
|
|
echo a - b
|
|
|
|
block:
|
|
# should produce warning for the unused 'echoSub'
|
|
implementArithOpsOld(int)
|
|
echoAdd 3, 5
|
|
|
|
block:
|
|
# no warning produced for the unused 'echoSub'
|
|
implementArithOpsNew(int)
|
|
echoAdd 3, 5
|
|
|
|
static:
|
|
echo "compile end"
|