This commit is contained in:
Araq
2019-07-19 22:38:35 +02:00
parent affe1be47c
commit 67a6effb7b
2 changed files with 14 additions and 1 deletions

View File

@@ -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"

View File

@@ -20,6 +20,14 @@ proc main =
main()
# bug #11745
type
Foo = object
bar: seq[int]
var x = [Foo()]
# bug #11563
type
MyTypeType = enum