This commit is contained in:
Araq 2019-07-19 22:38:35 +02:00
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 tyBool: result = rope"NIM_FALSE"
of tyEnum, tyChar, tyInt..tyInt64, tyUInt..tyUInt64: result = rope"0" of tyEnum, tyChar, tyInt..tyInt64, tyUInt..tyUInt64: result = rope"0"
of tyFloat..tyFloat128: result = rope"0.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: tyTyped, tyTypeDesc, tyStatic, tyRef, tyNil:
result = rope"NIM_NIL" result = rope"NIM_NIL"
of tyString, tySequence:
if p.config.selectedGC == gcDestructors:
result = rope"{0, NIM_NIL}"
else:
result = rope"NIM_NIL"
of tyProc: of tyProc:
if t.callConv != ccClosure: if t.callConv != ccClosure:
result = rope"NIM_NIL" result = rope"NIM_NIL"

View file

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