Ticket #254: all-empty-true.patch
File all-empty-true.patch, 2.4 KB (added by hopscc, 14 years ago) |
---|
-
Source/Cobra.Lang/Native.cs
269 269 } 270 270 271 271 static public bool All<T>(IEnumerable<T> items) { 272 int counter = 0; 272 273 foreach (T item in items) 274 { 275 counter++; 273 276 if (!IsTrue(item)) 274 277 return false; 278 } 279 if (counter == 0) 280 return false; 275 281 return true; 276 282 } 277 283 278 284 static public bool All(IEnumerable items) { 285 int counter = 0; 279 286 foreach (object item in items) 287 { 288 counter++; 280 289 if (!IsTrue(item)) 281 290 return false; 282 return true; 291 } 292 if (counter == 0) 293 return false; 294 return true; 283 295 } 284 296 285 297 static public bool Any<T>(IEnumerable<T> items) { -
Tests/500-dynamic/104-dynamic-ops.cobra
212 212 assert not all t 213 213 assert not any t 214 214 t.clear 215 assert all t215 assert not all t # change for tkt:254 216 216 assert not any t 217 217 218 218 def testConcat -
Tests/110-basics-two/604-all-any-ops.cobra
12 12 assert not all t 13 13 assert not any t 14 14 t.clear 15 assert all t15 assert not all t # # chg for tkt:254, all on empty list -> false 16 16 assert not any t 17 17 18 18 # sets … … 26 26 assert not all s 27 27 assert not any s 28 28 s.clear 29 assert all s29 assert not all s # chg for tkt:254, all on empty list -> false 30 30 assert not any s 31 31 32 32 # complex expressions -
Developer/IntermediateReleaseNotes.text
487 487 * Fixed: Some initialization expressions for a `var` or `const` declaration give an internal error. ticket:222 488 488 489 489 * Fixed: Using a struct-typed `result` in a method's `ensure` produces a false error message. ticket:219 490 491 * Fixed: all on empty list returns true instead of false. ticket:254