fixes requiresInit for var statements without initialization (#24177)

ref https://forum.nim-lang.org/t/12530
This commit is contained in:
ringabout
2024-09-26 12:28:40 +08:00
committed by GitHub
parent 3b85c1a2e9
commit 6d6489a9ab
3 changed files with 18 additions and 4 deletions

View File

@@ -0,0 +1,10 @@
discard """
errormsg: "The MPlayerObj type doesn't have a default value. The following fields must be initialized: foo."
"""
type
MPlayerObj* {.requiresInit.} = object
foo: range[5..10] = 5
var a: MPlayerObj
echo a.foo