[swift-dev] Property modification not taking effect

John McCall rjmccall at apple.com
Tue May 9 17:49:13 CDT 2017


> On May 9, 2017, at 3:07 PM, Pushkar N Kulkarni via swift-dev <swift-dev at swift.org> wrote:
> In the process of debugging a bunch of consistent failures in TestFoundation/TestNSURLSession, I came across a weird problem symptom in this line of code <https://github.com/apple/swift-corelibs-foundation/blob/master/Foundation/NSURLSession/NSURLSessionTask.swift#L329>.
> 
> internalState = .transferInProgress(transferState)
> 
> I had a suspicion that the above modification is not taking effect, since, only based on this change the didSet observer for the `internalState` property triggers data transfers using libcurl. So, I simply printed the property before and after the assignment. 
> 
> print("before => \(internalState)")
> internalState = .transferInProgress(transferState)
> print("after => \(internalState)")
> 
> Surprisingly, I don't see any change in the property value:
> before => transferReady(Foundation.URLSessionTask._TransferState(... <redacted> ...))
> after  => transferReady(Foundation.URLSessionTask._TransferState(... <redacted> ...))
> 
> When I switched back to the "swift-DEVELOPMENT-SNAPSHOT-2017-04-24-a" tag on all the repos (except swift-corelibs-foundation), I do not see this problem. I see:
> before => transferReady(Foundation.URLSessionTask._TransferState(... <redacted> ...))
> after  => transferInProgress(Foundation.URLSessionTask._TransferState(... <redacted> ...))
> 
> To put it in simple terms, the modification doesn't seem to be taking effect with the current HEAD. 
> 
> I haven't been able to isolate this problem in an independent test case. However, anybody who wants to reproduce it can simply run TestFoundation after enabling the URLSession tests (which have been disabled for now) in TestFoundation/main.swift. 
> 
> I did compare the `-emit-ir` outputs from the passing and failing levels. There seems to be a clear difference in the way we store the new value of this property. But given my limited exposure to debugging Swift compiler issues, I wasn't able to progress further.  
>  
> Can someone help us here please? Thanks. 

That sounds like a serious bug; please file it in JIRA.

John.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-dev/attachments/20170509/09bb49bf/attachment.html>


More information about the swift-dev mailing list