Xcode6-Beta (6A215l): Nested functions as parameter cannot decode AnyObject to underlying String or other objects

Originator:me
Number:rdar://17211862 Date Originated:06-Jun-2014 11:17 PM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode6-Beta (6A215l)
Classification:Serious Bug Reproducible:Always
 
Summary:
A function that declares a parameter as a function that receives AnyObject! cannot be called sending a function with String! as a parameter

Steps to Reproduce:
Run the following code on Xcode6 or using playgrounds

func test(text:String!, completionBlock:(object:AnyObject!)->()) {
	println("\(text)")
	
	completionBlock(object: text)
}

func fail(message:String!, completionBlock:(message:String!)->()) {
	println("\(message)")
	
	test(message, completionBlock:completionBlock)
}

Expected Results:
The method “test” should be called from “fail” passing “completionBlock” as the parameter for “completionBlock”

Actual Results:
Compilers throws the following error: “Cannot convert the expression’s type ‘()’ to type ‘String!’

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!