diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2019-09-02 17:48:06 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2019-09-02 17:48:06 +0200 |
commit | 5a03eea518ba3cfeaa9f57ef0b6f1cf7bc8ed1d9 (patch) | |
tree | d9d16955b3be3a6eee16c44712f210d2bf17af78 | |
parent | 545ddf4a4f60233c3e547f16fa4ce83563a7bf7f (diff) | |
download | Nim-5a03eea518ba3cfeaa9f57ef0b6f1cf7bc8ed1d9.tar.gz |
revert #12100; typeof(nil) is weird enough, don't allow it as the return type
-rw-r--r-- | compiler/types.nim | 2 | ||||
-rw-r--r-- | tests/ccgbugs/tnil_type.nim | 3 |
2 files changed, 1 insertions, 4 deletions
diff --git a/compiler/types.nim b/compiler/types.nim index 29d880ff6..e2de8280e 100644 --- a/compiler/types.nim +++ b/compiler/types.nim @@ -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: diff --git a/tests/ccgbugs/tnil_type.nim b/tests/ccgbugs/tnil_type.nim index 12310dae9..9921b24a3 100644 --- a/tests/ccgbugs/tnil_type.nim +++ b/tests/ccgbugs/tnil_type.nim @@ -13,6 +13,3 @@ f3(typeof(nil)) proc f4[T](_: T) = discard f4(nil) - -proc f5(): typeof(nil) = nil -discard f5() |