Erroneous "extra argument" compiler error

Originator:mikeyward
Number:rdar://17742999 Date Originated:20-Jul-2014 10:25 PM
Status:Open Resolved:
Product:Developer Tools Product Version:
Classification:Other Bug Reproducible:Always
 
Summary:
Compiler reports erroneous error complaining of extra argument in function call. In this case, i
Steps to Reproduce:
Create a new Swift class, with the following code:

import UIKit

class BazClient: NSObject {
    let session:NSURLSession?
    let workerQ = NSOperationQueue()
    
    init() {
        let config = NSURLSessionConfiguration.backgroundSessionConfiguration("com.foo.bar.baz”)
        let session = NSURLSession(configuration: config, delegate: self, delegateQueue: workerQ)
        super.init()
    }
}

Expected Results:
Code either compiles with no errors, or produces an error for the usage of “self” prior to super.init() call.

Actual Results:
Compiler reports error: “Extra argument ‘delegate’ in call” on line that begins “let session =“

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!