mirror of
https://github.com/nim-lang/Nim.git
synced 2026-06-04 10:54:42 +00:00
fixes #23943 --------- Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
This commit is contained in:
@@ -829,6 +829,11 @@ proc semVarOrLet(c: PContext, n: PNode, symkind: TSymKind): PNode =
|
||||
var typFlags: TTypeAllowedFlags = {}
|
||||
|
||||
var def: PNode = c.graph.emptyNode
|
||||
if typ != nil and typ.kind == tyRange and
|
||||
c.graph.config.isDefined("nimPreviewRangeDefault") and
|
||||
a[^1].kind == nkEmpty:
|
||||
a[^1] = firstRange(c.config, typ)
|
||||
|
||||
if a[^1].kind != nkEmpty:
|
||||
def = semExprWithType(c, a[^1], {efTypeAllowed}, typ)
|
||||
|
||||
|
||||
@@ -771,5 +771,10 @@ template main {.dirty.} =
|
||||
var s = default(Object)
|
||||
doAssert s.id == 1.2
|
||||
|
||||
block: # bug #23943
|
||||
type limited_int = range[1..20]
|
||||
var d: limited_int;
|
||||
doAssert d == 1
|
||||
|
||||
static: main()
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user