diff options
-rw-r--r-- | compiler/semtypes.nim | 4 | ||||
-rw-r--r-- | tests/errmsgs/t21257.nim | 20 |
2 files changed, 23 insertions, 1 deletions
diff --git a/compiler/semtypes.nim b/compiler/semtypes.nim index 844bc2070..aaffa1ea7 100644 --- a/compiler/semtypes.nim +++ b/compiler/semtypes.nim @@ -1310,13 +1310,15 @@ proc semProcTypeNode(c: PContext, n, genericParams: PNode, if hasDefault: def = a[^1] block determineType: + var defTyp = typ if genericParams != nil and genericParams.len > 0: + defTyp = nil def = semGenericStmt(c, def) if hasUnresolvedArgs(c, def): def.typ = makeTypeFromExpr(c, def.copyTree) break determineType - def = semExprWithType(c, def, {efDetermineType}) + def = semExprWithType(c, def, {efDetermineType}, defTyp) if def.referencesAnotherParam(getCurrOwner(c)): def.flags.incl nfDefaultRefsParam diff --git a/tests/errmsgs/t21257.nim b/tests/errmsgs/t21257.nim new file mode 100644 index 000000000..eecdb1dfe --- /dev/null +++ b/tests/errmsgs/t21257.nim @@ -0,0 +1,20 @@ +discard """ + action: compile + cmd: "nim check $file" +""" + +type AC_WINCTRL_Fields* = distinct uint8 + +type AC_STATUSA_WSTATE0* {.pure.} = enum + ABOVE = 0x0, + INSIDE = 0x1, + BELOW = 0x2, + +type AC_WINCTRL_WINTSEL0* {.pure.} = enum + ABOVE = 0x0, + INSIDE = 0x1, + BELOW = 0x2, + OUTSIDE = 0x3, + +proc write*(WINTSEL0: AC_WINCTRL_WINTSEL0 = ABOVE) = + discard |