Re: [swift-users] Swift 3 Whole Module Optimization Issue

2016-12-23 Thread Jun Zhang via swift-users
This is the bug report: https://bugs.swift.org/browse/SR-3474 On Thu, Dec 22, 2016 at 11:08 AM, Jun Zhang wrote: > Hi, everyone. >I think I found a swift 3 whole module optimization issue. The code > below, when building with release configuration and running on an

Re: [swift-users] Weird protocol behaviour.

2016-12-23 Thread Zhao Xin via swift-users
My previous theory was wrong. > P is an existential for x: P = … where it is upgraded to the static P in foo Why it needs to be upgraded? Why not just use `P` as a protocol instead of a `type`? Xcode error message calls `P` as a type. Zhaoxin On Fri, Dec 23, 2016 at 9:03 PM, Adrian Zubarev <

Re: [swift-users] Weird protocol behaviour.

2016-12-23 Thread Adrian Zubarev via swift-users
I’m not sure what you mean. P is an existential for x: P = … where it is upgraded to the static P in foo, but the static P does not conform to the existential P, which results in an error described by the OP. x: P = … here it’s Any any type that conforms to P. Any is a type of it’s own, and

Re: [swift-users] Possible bug in Swift REPL autocompletion?

2016-12-23 Thread Alex Blewitt via swift-users
I think this is a known issue but I don't know what the bug is. Please can you create a bug on https://bugs.swift.org and include a reproduction, including what output you see? Thanks, Alex > On 22 Dec 2016, at 21:19, Eugenio Baglieri via swift-users >

Re: [swift-users] Swift 3 Whole Module Optimization Issue

2016-12-23 Thread Alex Blewitt via swift-users
Can you raise a bug at https://bugs.swift.org with the details, including the crash dump? Thanks, Alex > On 22 Dec 2016, at 02:48, Jun Zhang via swift-users > wrote: > > Hi, everyone. >I think I found a swift 3 whole module optimization

Re: [swift-users] Weird protocol behaviour.

2016-12-23 Thread Adrian Zubarev via swift-users
I assume when we get existentials, your problem could be solved like this: protocol P {} class X: P {} func foo(_ x:A) {} func bar() { let x = X() as Any foo(x) } Here A will be Any which conforms to P and makes the compiler happy. let c: P = … here is P and existential like (future)

Re: [swift-users] Weird protocol behaviour.

2016-12-23 Thread Rien via swift-users
> On 23 Dec 2016, at 09:43, Mikhail Seriukov wrote: > > No it does not. > You have made a type out of the parameter. It’s no longer a protocol. > IMO the failure here is to understand the difference between a type and a > protocol. > A type (even if empty) is always a

Re: [swift-users] Weird protocol behaviour.

2016-12-23 Thread Adrian Zubarev via swift-users
What are you trying to solve here? Do you heavily rely on what A can be? Can’t you just write func foo(_ x: P) {} (here P is an existential like [in some future] Any)?! AnyObject is for classes, but you’d get the same result changing X to a class ;) If you want scratch the surface of what

Re: [swift-users] Weird protocol behaviour.

2016-12-23 Thread Mikhail Seriukov via swift-users
> > No it does not. > You have made a type out of the parameter. It’s no longer a protocol. > IMO the failure here is to understand the difference between a type and a > protocol. > A type (even if empty) is always a combination of storage with functions > (that are assumed to work on the data in