mirror of
https://github.com/nim-lang/Nim.git
synced 2026-05-28 15:55:14 +00:00
fixes
This commit is contained in:
@@ -459,9 +459,10 @@ proc normalizeTypedescMacroResult(c: PContext, n: PNode): PNode =
|
||||
if result.kind == nkStmtList:
|
||||
result.transitionSonsKind(nkStmtListType)
|
||||
|
||||
const maxTypedescMacroNormalizationPasses = 32
|
||||
# Resolve surviving compile-time branches so later passes don't walk
|
||||
# unevaluated type AST for a typedesc expression.
|
||||
while true:
|
||||
for _ in 0..<maxTypedescMacroNormalizationPasses:
|
||||
if result.kind == nkWhenStmt:
|
||||
result = semWhen(c, result, false)
|
||||
if result.kind == nkStmtList:
|
||||
|
||||
@@ -45,3 +45,12 @@ elif compiles(nonexistent):
|
||||
else:
|
||||
output("whenElse")
|
||||
|
||||
|
||||
template test(): typedesc =
|
||||
when true:
|
||||
int
|
||||
else:
|
||||
bool
|
||||
|
||||
const c = default(test())
|
||||
echo c
|
||||
|
||||
Reference in New Issue
Block a user