fixes default float ranges (#23957)

This commit is contained in:
ringabout
2024-08-16 21:50:31 +08:00
committed by GitHub
parent 995081b56a
commit e96fad1eed
3 changed files with 22 additions and 6 deletions

View File

@@ -744,6 +744,10 @@ template main {.dirty.} =
var b = default ArrayObj2
doAssert b.list[North] == 1
block:
type limited_float = range[1.2..20.0]
doAssert default(limited_float) == 1.2
block:
type
@@ -759,5 +763,13 @@ template main {.dirty.} =
foo()
block:
type
Object = object
id: range[1.2..29.3]
var s = default(Object)
doAssert s.id == 1.2
static: main()
main()