mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 17:04:41 +00:00
fixes #11745
This commit is contained in:
@@ -2709,9 +2709,14 @@ proc getDefaultValue(p: BProc; typ: PType; info: TLineInfo): Rope =
|
||||
of tyBool: result = rope"NIM_FALSE"
|
||||
of tyEnum, tyChar, tyInt..tyInt64, tyUInt..tyUInt64: result = rope"0"
|
||||
of tyFloat..tyFloat128: result = rope"0.0"
|
||||
of tyCString, tyString, tyVar, tyLent, tyPointer, tyPtr, tySequence, tyUntyped,
|
||||
of tyCString, tyVar, tyLent, tyPointer, tyPtr, tyUntyped,
|
||||
tyTyped, tyTypeDesc, tyStatic, tyRef, tyNil:
|
||||
result = rope"NIM_NIL"
|
||||
of tyString, tySequence:
|
||||
if p.config.selectedGC == gcDestructors:
|
||||
result = rope"{0, NIM_NIL}"
|
||||
else:
|
||||
result = rope"NIM_NIL"
|
||||
of tyProc:
|
||||
if t.callConv != ccClosure:
|
||||
result = rope"NIM_NIL"
|
||||
|
||||
@@ -20,6 +20,14 @@ proc main =
|
||||
|
||||
main()
|
||||
|
||||
# bug #11745
|
||||
|
||||
type
|
||||
Foo = object
|
||||
bar: seq[int]
|
||||
|
||||
var x = [Foo()]
|
||||
|
||||
# bug #11563
|
||||
type
|
||||
MyTypeType = enum
|
||||
|
||||
Reference in New Issue
Block a user