The Swift compiler returns the wrong value for __FUNCTION__

Originator:dave
Number:rdar://17219684 Date Originated:07-Jun-2014 10:18 PM
Status:Duplicate: 17150707 Resolved:
Product:Developer Tools Product Version:Xcode 6 Beta 1
Classification:UI/Usability Reproducible:Always
 
Summary:
The value of __FUNCTION__ has the function name appended to it on each call, instead of just returning the function name once.

The problem is seen in projects and in the playground.  Here's sample playground code to illustrate the issue:

func x() {
    __FUNCTION__ // x()
    __FUNCTION__ // x()x()
    __FUNCTION__ // x()x()x()
}

The value should always just be "x()", each time, it shouldn't expand each time it's used.

Steps to Reproduce:
View the value of __FUNCTION__ two or more times in the same function.

Expected Results:
__FUNCTION__ should always (in the same function) have the same value.

func x() {
    __FUNCTION__ // x()
    __FUNCTION__ // x()
    __FUNCTION__ // x()
}


Actual Results:
__FUNCTION__ has the function name appended on each call.

func x() {
    __FUNCTION__ // x()
    __FUNCTION__ // x()x()
    __FUNCTION__ // x()x()x()
}



Version:
Xcode 6 Beta 1

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!