Skip to content

Swift 4.x support #1

@dsperling

Description

@dsperling

I was attempting to compile this with Swift 4.0.3 and got a strange compiler error. No code changes were identified by the Swift conversion tool. Here is the updated Package.swift for 4.x:

// swift-tools-version:4.0
import PackageDescription

let package = Package(
    name: "AlexaSkillsKit",
    targets: [
        .target(name: "AlexaSkillsKit", exclude: ["Samples"]),
        .testTarget(name: "AlexaSkillsKitTests", dependencies: ["AlexaSkillsKit"])
    ]
)

The compile error is the following after setting .swift-version to 4.0.3:

./build-linux.sh 
Compile Swift Module 'AlexaSkillsKit' (8 sources)
Compile Swift Module 'AlexaSkillsKitTests' (6 sources)
/app/Tests/AlexaSkillsKitTests/RequestDispatcherTests.swift:12:80: error: extra argument 'sessionAttributes' in call
        next(.success(standardResponse: StandardResponse(), sessionAttributes: [String: Any]()))
                                                                               ^~~~~~~~~~~~~~~
/app/Tests/AlexaSkillsKitTests/RequestDispatcherTests.swift:17:80: error: extra argument 'sessionAttributes' in call
        next(.success(standardResponse: StandardResponse(), sessionAttributes: [String: Any]()))
                                                                               ^~~~~~~~~~~~~~~
/app/Tests/AlexaSkillsKitTests/RequestDispatcherTests.swift:22:23: error: missing argument for parameter #1 in call
        next(.success())
                      ^
                      <#T#>
AlexaSkillsKit.Result:2:10: note: 'success' declared here
    case success(T)
         ^
/app/Tests/AlexaSkillsKitTests/RequestHandlerTests.swift:7:80: error: extra argument 'sessionAttributes' in call
        next(.success(standardResponse: StandardResponse(), sessionAttributes: [:]))
                                                                               ^~~
/app/Tests/AlexaSkillsKitTests/RequestHandlerTests.swift:11:80: error: extra argument 'sessionAttributes' in call
        next(.success(standardResponse: StandardResponse(), sessionAttributes: [:]))
                                                                               ^~~
/app/Tests/AlexaSkillsKitTests/RequestHandlerTests.swift:15:23: error: missing argument for parameter #1 in call
        next(.success())
                      ^
                      <#T#>
AlexaSkillsKit.Result:2:10: note: 'success' declared here
    case success(T)
         ^

I have seen similar errors in Swift 2->3 ports, but it was always a type mis-match in the code. The code looks correct in this case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions