@@ -127,33 +127,33 @@ func (s *testUtilSuite) TestPushDownNot(c *check.C) {
127
127
c .Assert (notFunc .Equal (ctx , notFuncCopy ), check .IsTrue )
128
128
129
129
// issue 15725
130
- // (not not a) should be optimized to (a is true )
130
+ // (not not a) should not be optimized to (a)
131
131
notFunc = newFunction (ast .UnaryNot , col )
132
132
notFunc = newFunction (ast .UnaryNot , notFunc )
133
133
ret = PushDownNot (ctx , notFunc )
134
- c .Assert (ret .Equal (ctx , newFunction ( ast . IsTruth , col )) , check .IsTrue )
134
+ c .Assert (ret .Equal (ctx , col ), check .IsFalse )
135
135
136
- // (not not (a+1)) should be optimized to (a+1 is true )
136
+ // (not not (a+1)) should not be optimized to (a+1)
137
137
plusFunc := newFunction (ast .Plus , col , One )
138
138
notFunc = newFunction (ast .UnaryNot , plusFunc )
139
139
notFunc = newFunction (ast .UnaryNot , notFunc )
140
140
ret = PushDownNot (ctx , notFunc )
141
- c .Assert (ret .Equal (ctx , newFunction ( ast . IsTruth , plusFunc )) , check .IsTrue )
141
+ c .Assert (ret .Equal (ctx , col ) , check .IsFalse )
142
142
143
- // (not not not a) should be optimized to (not (a is true) )
143
+ // (not not not a) should be optimized to (not a )
144
144
notFunc = newFunction (ast .UnaryNot , col )
145
145
notFunc = newFunction (ast .UnaryNot , notFunc )
146
146
notFunc = newFunction (ast .UnaryNot , notFunc )
147
147
ret = PushDownNot (ctx , notFunc )
148
- c .Assert (ret .Equal (ctx , newFunction (ast .UnaryNot , newFunction ( ast . IsTruth , col ) )), check .IsTrue )
148
+ c .Assert (ret .Equal (ctx , newFunction (ast .UnaryNot , col )), check .IsTrue )
149
149
150
- // (not not not not a) should be optimized to (a is true )
150
+ // (not not not not a) should be optimized to (not not a )
151
151
notFunc = newFunction (ast .UnaryNot , col )
152
152
notFunc = newFunction (ast .UnaryNot , notFunc )
153
153
notFunc = newFunction (ast .UnaryNot , notFunc )
154
154
notFunc = newFunction (ast .UnaryNot , notFunc )
155
155
ret = PushDownNot (ctx , notFunc )
156
- c .Assert (ret .Equal (ctx , newFunction (ast .IsTruth , col )), check .IsTrue )
156
+ c .Assert (ret .Equal (ctx , newFunction (ast .UnaryNot , newFunction ( ast . UnaryNot , col ) )), check .IsTrue )
157
157
}
158
158
159
159
func (s * testUtilSuite ) TestFilter (c * check.C ) {
0 commit comments