summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--compiler/sempass2.nim1
-rw-r--r--tests/notnil/tmust_compile.nim13
2 files changed, 13 insertions, 1 deletions
diff --git a/compiler/sempass2.nim b/compiler/sempass2.nim
index 5add78268..66c736146 100644
--- a/compiler/sempass2.nim
+++ b/compiler/sempass2.nim
@@ -518,6 +518,7 @@ proc notNilCheck(tracked: PEffects, n: PNode, paramType: PType) =
     procVarcheck skipConvAndClosure(n)
   #elif n.kind in nkSymChoices:
   #  echo "came here"
+  let paramType = paramType.skipTypesOrNil(abstractInst)
   if paramType != nil and tfNotNil in paramType.flags and
       n.typ != nil and tfNotNil notin n.typ.flags:
     if n.kind == nkAddr:
diff --git a/tests/notnil/tmust_compile.nim b/tests/notnil/tmust_compile.nim
index c81c3b16b..83c8ff92b 100644
--- a/tests/notnil/tmust_compile.nim
+++ b/tests/notnil/tmust_compile.nim
@@ -23,4 +23,15 @@ var b = Obj() # this doesn't (also doesn't works with additional fields)
 
 var z = Obj2[int]()
 
-echo "success"
\ No newline at end of file
+echo "success"
+
+# bug #6555
+
+import tables
+
+type
+  TaskOrNil = ref object
+  Task = TaskOrNil not nil
+
+let table = newTable[string, Task]()
+table.del("task")