revert #12100; typeof(nil) is weird enough, don't allow it as the return type

This commit is contained in:
Andreas Rumpf 2019-09-02 17:48:06 +02:00
commit 5a03eea518
2 changed files with 1 additions and 4 deletions

View file

@ -1310,7 +1310,7 @@ proc typeAllowedAux(marker: var IntSet, typ: PType, kind: TSymKind,
tyNone, tyForward, tyFromExpr: tyNone, tyForward, tyFromExpr:
result = t result = t
of tyNil: of tyNil:
if kind != skConst and kind != skParam and kind != skResult: result = t if kind != skConst and kind != skParam: result = t
of tyString, tyBool, tyChar, tyEnum, tyInt..tyUInt64, tyCString, tyPointer: of tyString, tyBool, tyChar, tyEnum, tyInt..tyUInt64, tyCString, tyPointer:
result = nil result = nil
of tyOrdinal: of tyOrdinal:

View file

@ -13,6 +13,3 @@ f3(typeof(nil))
proc f4[T](_: T) = discard proc f4[T](_: T) = discard
f4(nil) f4(nil)
proc f5(): typeof(nil) = nil
discard f5()