mirror of
https://github.com/nim-lang/Nim.git
synced 2026-06-03 10:24:44 +00:00
revert #12100; typeof(nil) is weird enough, don't allow it as the return type
This commit is contained in:
@@ -1310,7 +1310,7 @@ proc typeAllowedAux(marker: var IntSet, typ: PType, kind: TSymKind,
|
||||
tyNone, tyForward, tyFromExpr:
|
||||
result = t
|
||||
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:
|
||||
result = nil
|
||||
of tyOrdinal:
|
||||
|
||||
@@ -13,6 +13,3 @@ f3(typeof(nil))
|
||||
|
||||
proc f4[T](_: T) = discard
|
||||
f4(nil)
|
||||
|
||||
proc f5(): typeof(nil) = nil
|
||||
discard f5()
|
||||
|
||||
Reference in New Issue
Block a user