summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'compiler')
-rw-r--r--compiler/ccgtypes.nim1
-rw-r--r--compiler/jsgen.nim2
-rw-r--r--compiler/types.nim2
3 files changed, 4 insertions, 1 deletions
diff --git a/compiler/ccgtypes.nim b/compiler/ccgtypes.nim
index 1e3826780..5c5999e82 100644
--- a/compiler/ccgtypes.nim
+++ b/compiler/ccgtypes.nim
@@ -155,6 +155,7 @@ proc mapType(conf: ConfigRef; typ: PType): TCTypeKind =
   of tyNone, tyTyped: result = ctVoid
   of tyBool: result = ctBool
   of tyChar: result = ctChar
+  of tyNil: result = ctPtr
   of tySet: result = mapSetType(conf, typ)
   of tyOpenArray, tyArray, tyVarargs, tyUncheckedArray: result = ctArray
   of tyObject, tyTuple: result = ctStruct
diff --git a/compiler/jsgen.nim b/compiler/jsgen.nim
index 107fa2b28..1d980ab6f 100644
--- a/compiler/jsgen.nim
+++ b/compiler/jsgen.nim
@@ -1600,6 +1600,8 @@ proc createVar(p: PProc, typ: PType, indirect: bool): Rope =
     result = putToSeq("{}", indirect)
   of tyBool:
     result = putToSeq("false", indirect)
+  of tyNil:
+    result = putToSeq("null", indirect)
   of tyArray:
     let length = toInt(lengthOrd(p.config, t))
     let e = elemType(t)
diff --git a/compiler/types.nim b/compiler/types.nim
index 1473be261..3a5f5fa62 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: result = t
+    if kind != skConst and kind != skParam and kind != skResult: result = t
   of tyString, tyBool, tyChar, tyEnum, tyInt..tyUInt64, tyCString, tyPointer:
     result = nil
   of tyOrdinal: