diff options
author | Simon Hafner <hafnersimon@gmail.com> | 2014-06-18 18:47:45 -0500 |
---|---|---|
committer | Simon Hafner <hafnersimon@gmail.com> | 2014-06-18 18:47:45 -0500 |
commit | be534279da5021aa5e6621430a52ee1573f1a01f (patch) | |
tree | f70447285ea244d477eba30d16f52e79589ecfb6 | |
parent | 7ebbc09578a0204a9bcf361a351e514dec0219c3 (diff) | |
parent | a48c728ab3f8d3b0a3357d62b352d9913a600d9e (diff) | |
download | Nim-be534279da5021aa5e6621430a52ee1573f1a01f.tar.gz |
Merge pull request #1279 from Varriount/fix-1216
Fix issue #1216
-rw-r--r-- | compiler/guards.nim | 2 | ||||
-rw-r--r-- | tests/notnil/tnotnil4.nim | 14 |
2 files changed, 15 insertions, 1 deletions
diff --git a/compiler/guards.nim b/compiler/guards.nim index 813a30014..4cf06fe02 100644 --- a/compiler/guards.nim +++ b/compiler/guards.nim @@ -625,7 +625,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: 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 |