mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-12 06:18:51 +00:00
fix bug in semgnrc: runnableExamples should not semcheck, even with > 1 arg (#14768)
This commit is contained in:
@@ -265,7 +265,7 @@ proc semGenericStmt(c: PContext, n: PNode,
|
||||
# We're not interested in the example code during this pass so let's
|
||||
# skip it
|
||||
if s.magic == mRunnableExamples:
|
||||
inc first
|
||||
first = result.safeLen # see trunnableexamples.fun3
|
||||
of skGenericParam:
|
||||
result[0] = newSymNodeTypeDesc(s, fn.info)
|
||||
onUse(fn.info, s)
|
||||
|
||||
@@ -91,6 +91,16 @@ when true: # runnableExamples with rdoccmd
|
||||
proc fun2*() =
|
||||
runnableExamples "-d:foo": discard # checks that it also works inside procs
|
||||
|
||||
template fun3Impl(): untyped =
|
||||
runnableExamples(rdoccmd="-d:foo"):
|
||||
nonexistant
|
||||
# bugfix: this shouldn't be semchecked when `runnableExamples`
|
||||
# has more than 1 argument
|
||||
discard
|
||||
|
||||
proc fun3*[T]() =
|
||||
fun3Impl()
|
||||
|
||||
when false: # future work
|
||||
# passing non-string-litterals (for reuse)
|
||||
const a = "-b:cpp"
|
||||
|
||||
Reference in New Issue
Block a user