[swift-users] Is there an equivalence method on `NSArray`'s `func objects(at indexes: IndexSet) -> [Any]` in Array?

2016-10-06 Thread Zhao Xin via swift-users
I managed to do that by using `map` as I didn't find the equivalence. files.forEach { var indices = IndexSet() for index in 0 ..< subtitleFiles.count { if $0.sn == subtitleFiles[index].sn { indices.insert(index) } } let subtitles = indices.map

Re: [swift-users] Swift REPL broken after updating to Sierra, is it just me?

2016-10-06 Thread Jens Persson via swift-users
Thanks! I moved the following to a temporary location: ~ ├── .lldb │ ├── lldb-history │ ├── lldb-repl-history │ └── lldb-swift-history └── .lldb-swift-history And that made the REPL work again. I will zip and attach those files to 28657007. /Jens On Thu, Oct 6, 2016 at 9:52 PM, Jim Ingham

Re: [swift-users] Overload Resolution

2016-10-06 Thread Toni Suter via swift-users
Hi Mark, Thanks for pointing me into the right direction! Best regards, Toni > Am 06.10.2016 um 16:31 schrieb Mark Lacey : > > >> On Oct 6, 2016, at 4:53 AM, Toni Suter via swift-users >> mailto:swift-users@swift.org>> wrote: >> >> Hi, >> >> Does someone know a good explanation / summary of

Re: [swift-users] Swift REPL broken after updating to Sierra, is it just me?

2016-10-06 Thread Jim Ingham via swift-users
There is a known bug in libedit's history file reader that can cause this crash. libedit is a system component that lldb uses to do command-line editing and the like. Try moving ~/.lldb-history to some other name, and then rerunning the REPL. If that works, can you attach that history file to

Re: [swift-users] Swift REPL broken after updating to Sierra, is it just me?

2016-10-06 Thread Jens Persson via swift-users
I've filed radar 28657007 and attached the two crashlogs that is generated (one for lldb, and one for repl_swift. /Jens On Thu, Oct 6, 2016 at 9:25 PM, Jens Persson wrote: > Here is with Xcode.app: > > › sudo xcode-select -s /Applications/Xcode.app > Password: > › > › swift -v > Apple Swift vers

Re: [swift-users] Swift REPL broken after updating to Sierra, is it just me?

2016-10-06 Thread Jens Persson via swift-users
Here is with Xcode.app: › sudo xcode-select -s /Applications/Xcode.app Password: › › swift -v Apple Swift version 3.0 (swiftlang-800.0.46.2 clang-800.0.38) Target: x86_64-apple-macosx10.9 /Applications/Xcode.app/Contents/Developer/usr/bin/lldb "--repl=-target x86_64-apple-macosx10.9 -enable-objc-i

Re: [swift-users] Swift REPL broken after updating to Sierra, is it just me?

2016-10-06 Thread Jens Persson via swift-users
I was trying both Xcode and Xcode-beta, I just happened to copy paste while Xcode-beta was selected ... Anyway, both of them crash like that. /Jens On Thu, Oct 6, 2016 at 7:22 PM, Kate Stone wrote: > If you’ve specified “sudo xcode-select -s /Applications/Xcode.app” then > it’s surprising that

[swift-users] DispatchQueue extension

2016-10-06 Thread Nick Brook via swift-users
I have an extension on DispatchQueue and I have Objective-C code which uses my swift code, so the DispatchQueue extension is exported to the Swift objective-c header as @interface OS_dispatch_queue However, Xcode 8.0 and 8.2b2 both error ‘Cannot find interface declaration for ‘OS_dispatch_queu

Re: [swift-users] [swift-evolution] [Question] Types of functions

2016-10-06 Thread Adrian Zubarev via swift-users
Maybe :D No actually I had to test an iOS app feature depending on that date but forget to reset the system date and time. --  Adrian Zubarev Sent with Airmail Am 6. Oktober 2016 um 20:38:53, Vladimir.S (sva...@gmail.com) schrieb: (Adrian, are you from the future? ;-)  ___

Re: [swift-users] [swift-evolution] [Question] Types of functions

2016-10-06 Thread Vladimir.S via swift-users
On 12.11.2016 11:38, Adrian Zubarev via swift-users wrote: (Adrian, are you from the future? ;-) We should move this thread to swift-users. Here is something that I just tried: |func foo(_: Int, _: Int) {} func boo(_: (Int, Int)) {} type(of: foo) == type(of: boo) //=> true ; (((Int, Int)) ->

Re: [swift-users] Segfault: 11 only when running tests (XCode 8, Swift 2.3)

2016-10-06 Thread Jordan Rose via swift-users
Can you double-check that all of your Utilities headers are Public or Private headers (not Project)? You can check this under the Build Phases tab for the framework target. If that doesn't do it, we can probably help more with a bug report, if you're willing to share your project. Jordan > O

Re: [swift-users] Swift REPL broken after updating to Sierra, is it just me?

2016-10-06 Thread Kate Stone via swift-users
If you’ve specified “sudo xcode-select -s /Applications/Xcode.app” then it’s surprising that the REPL session is attempting to use the LLDB and SDK from /Applications/Xcode-beta.app. Can you double-check what “xcode-select -p” reports? I can’t say I’ve seen a segmentation fault on REPL launch.

Re: [swift-users] Overload Resolution

2016-10-06 Thread Mark Lacey via swift-users
> On Oct 6, 2016, at 7:31 AM, Mark Lacey wrote: > > >> On Oct 6, 2016, at 4:53 AM, Toni Suter via swift-users >> mailto:swift-users@swift.org>> wrote: >> >> Hi, >> >> Does someone know a good explanation / summary of Swift's overload >> resolution rules? >> After reading >> https://github.

Re: [swift-users] Overload Resolution

2016-10-06 Thread Mark Lacey via swift-users
> On Oct 6, 2016, at 4:53 AM, Toni Suter via swift-users > wrote: > > Hi, > > Does someone know a good explanation / summary of Swift's overload resolution > rules? > After reading https://github.com/apple/swift/blob/master/docs/TypeChecker.rst >

[swift-users] Swift REPL broken after updating to Sierra, is it just me?

2016-10-06 Thread Jens Persson via swift-users
After updating to Sierra I can no longer use the Swift REPL. It crashes immediately (see Terminal session below). Anyone else having the same problem, any workaround? It didn't help to download and reinstall the command line tools for 10.12. (I had Xcode 8 and 8.1 beta installed before updating t

[swift-users] Segfault: 11 only when running tests (XCode 8, Swift 2.3)

2016-10-06 Thread Thomas Abend via swift-users
Since moving a mixed Swift and Objective-c project to XCode 8 with Swift 2.3, I have been getting a "Command failed due to signal: Segmentation fault: 11" error every time I run my tests after making a change in any of the test files. When I click on the error for more information I see: :1:9: no

[swift-users] Overload Resolution

2016-10-06 Thread Toni Suter via swift-users
Hi, Does someone know a good explanation / summary of Swift's overload resolution rules? After reading https://github.com/apple/swift/blob/master/docs/TypeChecker.rst I understand that the overloading resolution happens as part of

Re: [swift-users] Binary Operator '??' cannot be applied to operands of type 'T?' and 'Never'

2016-10-06 Thread Jacob Bandes-Storch via swift-users
Has there still not been a formal proposal for "Never as universal subtype/bottom"? Someone please propose it :) Jacob On Sat, Nov 12, 2016 at 12:20 AM, Adrian Zubarev via swift-users < swift-users@swift.org> wrote: > I’ve build a custom operator for this: https://gist.github.com/ > DevAndArtist

Re: [swift-users] [swift-evolution] [Question] Types of functions

2016-10-06 Thread Adrian Zubarev via swift-users
We should move this thread to swift-users. Here is something that I just tried: func foo(_: Int, _: Int) {} func boo(_: (Int, Int)) {} type(of: foo) == type(of: boo) //=> true ; (((Int, Int)) -> ()).Type let tuple = (0, 42) foo(tuple) // Tuple splat was removed => Error boo(tuple) // Expected =>

Re: [swift-users] Binary Operator '??' cannot be applied to operands of type 'T?' and 'Never'

2016-10-06 Thread Adrian Zubarev via swift-users
I’ve build a custom operator for this: https://gist.github.com/DevAndArtist/dad641ee833e60b02fd1db2dbb488c6a infix operator ?! : NilCoalescingPrecedence func ?!(optional: T?, noreturn: @autoclosure () -> Never) -> T { switch optional { case .some(let value): return value case .non