You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2018/05/15 01:43:33 UTC

[GitHub] csantanapr opened a new issue #60: Swift 4.1 issue discovered around Structs with two Strings

csantanapr opened a new issue #60: Swift 4.1 issue discovered around Structs with two Strings
URL: https://github.com/apache/incubator-openwhisk-runtime-swift/issues/60
 
 
   @eweiter commented on [Fri May 11 2018](https://github.com/apache/incubator-openwhisk/issues/3646)
   
   It was reported that the Swift 4.1 runtime was exhibiting a strange behavior.  The behavior in question occurs when a Struct has multiple Strings and those Strings are being initialized directly from static Strings. 
   
   For instance, the following piece of code will work:
   ```
   struct Output: Codable {
       let greeting: String
       let group: String
   }
   func main(completion: (Output?, Error?) -> Void) -> Void {
       let name = "MyName"
       let result = Output(greeting: "Hello \(name)", group: "Greetings")
       print("Log greeting:\(result.greeting)")
       completion(result, nil)
   }
   ```
   However the following code will not:
   ```
   struct Output: Codable {
       let greeting: String
       let group: String
   }
   func main(completion: (Output?, Error?) -> Void) -> Void {
       let result = Output(greeting: "Hello Name", group: "bummer")
       print("Log greeting:\(result.greeting)")
       completion(result, nil)
   }
   ```
   
   It appears to be a bug within Swift itself. 
   We have discovered that if the code is compiled with the compiler flag to turn off optimizations then the compiling will work.  This compile flag is `-Xswiftc -Onone`
   
   ---
   
   @eweiter commented on [Sun May 13 2018](https://github.com/apache/incubator-openwhisk/issues/3646#issuecomment-388636175)
   
   PR https://github.com/apache/incubator-openwhisk/pull/3647 was merged as a temp fix until the issue is addressed in the Swift Docker image. 
   
   ---
   
   @eweiter commented on [Mon May 14 2018](https://github.com/apache/incubator-openwhisk/issues/3646#issuecomment-389001553)
   
   I believe I have narrowed down the reasoning for this issue as coming from the use of the "@escaping" syntax in here https://github.com/apache/incubator-openwhisk-runtime-swift/blob/master/core/swift41Action/epilogue.swift#L98
   
   I have stripped down this code the mainly the essentials (non-whisk related) items and when the "@escaping" option is present the code will throw a compiler error, however when I remove the statement the code will compile fine and execute successfully.
   
   I will be opening an issue against the Swift Docker image tomorrow and will link that here when I do. 
   
   ---
   
   @csantanapr commented on [Mon May 14 2018](https://github.com/apache/incubator-openwhisk/issues/3646#issuecomment-389012394)
   
   leaving open until we get a fix from swift team
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services