From ec23f5ec0a5d65a8aca2dadddf052852f53d83ba Mon Sep 17 00:00:00 2001 From: Clay Sweetser Date: Mon, 26 May 2014 07:24:57 -0400 Subject: [PATCH 1/2] Fix issue #1216 --- compiler/guards.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/guards.nim b/compiler/guards.nim index f475f5068..2b69024d2 100644 --- a/compiler/guards.nim +++ b/compiler/guards.nim @@ -484,7 +484,7 @@ proc factImplies(fact, prop: PNode): TImplication = # == not a or not b == not (a and b) let arg = fact.sons[1] case arg.getMagic - of mIsNil: + of mIsNil, mEqRef: return ~factImplies(arg, prop) of mAnd: # not (a and b) means not a or not b: From a48c728ab3f8d3b0a3357d62b352d9913a600d9e Mon Sep 17 00:00:00 2001 From: Clay Sweetser Date: Wed, 18 Jun 2014 17:47:37 -0400 Subject: [PATCH 2/2] Added notnil test for issue #1216 --- tests/notnil/tnotnil4.nim | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 tests/notnil/tnotnil4.nim diff --git a/tests/notnil/tnotnil4.nim b/tests/notnil/tnotnil4.nim new file mode 100644 index 000000000..23968ee48 --- /dev/null +++ b/tests/notnil/tnotnil4.nim @@ -0,0 +1,14 @@ +discard "" +type + TObj = ref object + +proc check(a: TObj not nil) = + echo repr(a) + +proc doit() = + var x : array[0..1, TObj] + + if x[0] != nil: + check(x[0]) + +doit() \ No newline at end of file