This commit is contained in:
Araq
2014-11-19 23:40:26 +01:00
parent 32ec5af60a
commit abb2c21047
2 changed files with 20 additions and 0 deletions

View File

@@ -242,6 +242,9 @@ proc concreteType(c: TCandidate, t: PType): PType =
addSonSkipIntLit(result, t.sons[1]) # XXX: semantic checking for the type?
of tyNil:
result = nil # what should it be?
of tySequence, tySet:
if t.sons[0].kind == tyEmpty: result = nil
else: result = t
of tyGenericParam, tyAnything:
result = t
while true:

View File

@@ -0,0 +1,17 @@
discard """
errormsg: "type mismatch: got (seq[empty])"
line: 16
"""
# bug #836
type
TOption*[T] = object
case FIsSome: bool
of false: nil
of true: FData: T
proc some*[T](value: T): TOption[T] = TOption[T](FIsSome: true, FData: value)
echo some(@[]).FIsSome