Filter not compiling as expected

When I try to use a filter to restrict the files I am looking at in a directory using

let InputDir = try! FileManager.defaultManager.contentsOfDirectory(atPath: tPath.stringValue)
let txtFiles = InputDir.filter( $0.pathExtension == “txt”)

I get the error ‘No anonymous method is in scope’ with $0 on the second line highlighted

This works fine in native Swift, is the syntax different in Silver?

i believe this needs curly braces, no?

let txtFiles = InputDir.filter({ $0.pathExtension == “txt” })

Unfortunately, that gives the error ‘No matching overload’ with .filter highlighted

Hmm, let me see… What platform, .NET?

Reproduced. this looks like a big, since finter is defined as

public func filter(_ includeElement: (_ param0: id) -> Bool throws<T>!, error $error: inout NSError!) -> ISequence<T>

E25476, sorry. somehow the post-back from the bugdb didn’t go thru; my mistake.

Can you let me know when it makes its way into a released version?

I’ve updated/fixed the issue so that updates should be posted here; once it’s marked as fixed, it will be in the following Friday’s build.

Meanwhile, if a bit cumbersome, filter() does work on [T], so of you cast the NSArray to [NSString], it does compile:

let txtFiles = (InputDir as! [NSString]).filter( {$0.pathExtension == "txt"} )

bugs://E25476 was closed as fixed.