Re: [swift-users] @noReturn

2017-03-24 Thread Saagar Jha via swift-users
By the way, return Never used to be called @noreturn, so you weren't far off! On Fri, Mar 24, 2017 at 02:22 Rien via swift-users wrote: > Excellent! > > Love this list ;-) > > Regards, > Rien > > Site: http://balancingrock.nl > Blog: http://swiftrien.blogspot.com > Github:

Re: [swift-users] Memory Leak of Dictionary used in singleton

2017-03-24 Thread Joe Groff via swift-users
> On Mar 11, 2017, at 4:04 PM, Ekaterina Belinskaya via swift-users > wrote: > > Hi everyone! > > I have singleton. It contains a 2 dictionaries. > > struct Stat { > var statHash:String > var displayDescription:String > var displayName:String > var

Re: [swift-users] Type inference of array element type

2017-03-24 Thread Toni Suter via swift-users
Ok, I submitted a bug report (https://bugs.swift.org/browse/SR-4347 ) and I'll try to fix it in the next few days. Thanks and best regards Toni > Am 24.03.2017 um 18:51 schrieb Mark Lacey : > >> >> On Mar 24, 2017, at 3:08 AM, Toni

Re: [swift-users] Type inference of array element type

2017-03-24 Thread Mark Lacey via swift-users
> On Mar 24, 2017, at 3:08 AM, Toni Suter via swift-users > wrote: > > Hi, > > If I declare a variable and initialize it with an array literal whose > elements are integer literals and nil literals, > the compiler will infer the type Array for that variable:

Re: [swift-users] Type inference of array element type

2017-03-24 Thread Rien via swift-users
I always yield to proof ;-) hope someone more knowledgable chips in... Regards, Rien Site: http://balancingrock.nl Blog: http://swiftrien.blogspot.com Github: http://github.com/Balancingrock Project: http://swiftfire.nl > On 24 Mar 2017, at 11:53, Toni Suter wrote: > >

Re: [swift-users] @noReturn

2017-03-24 Thread Zhao Xin via swift-users
Change you `func findReasonAndTerminate()` to `func findReasonAndTerminate() -> String`. Then you can use `fatalError(func findReasonAndTerminate())`. Zhaoxin On Fri, Mar 24, 2017 at 5:02 PM, Rien via swift-users wrote: > Is there any way to mark a function as “no

Re: [swift-users] @noReturn

2017-03-24 Thread Philip Erickson via swift-users
I believe returning Never does what you want, e.g. import Foundation func findReasonAndTerminate() -> Never { let reason: String = findReason() fatalError(reason) } func findReason() -> String { return "some reason" } func buildData() -> Data? { return nil } guard let data =