diff options
author | Araq <rumpf_a@web.de> | 2017-11-23 01:17:13 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2017-11-23 01:17:13 +0100 |
commit | df13b2a89222c24474df454d0336f1f20162bdc7 (patch) | |
tree | 36c9197e200a93e376e4b9b9ac2665be9fc6c285 | |
parent | a6226d9452194cc3b8d35a0d38d9f8c89ddf04f5 (diff) | |
download | Nim-df13b2a89222c24474df454d0336f1f20162bdc7.tar.gz |
fixes #6555
-rw-r--r-- | compiler/sempass2.nim | 1 | ||||
-rw-r--r-- | tests/notnil/tmust_compile.nim | 13 |
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") |