为什么 Swift playground 显示错误的执行次数?

Why does Swift playground shows wrong number of executions?

我正在使用完成处理程序来汇总数字。我不明白的是,如果我将代码分成两行,执行次数将从 6 次变为 7 次!!为什么?

 func summer (from : Int, to: Int, handler: (Int) -> (Int)) -> Int {
        var sum = 0
        for i in from...to {
            sum += handler(i)
        }
        return sum

}

summer(1, to:6){ //Shows '21'
    return [=11=]} // shows '(6 times)'


// Same code, but in 1 line
summer(1, to:6){return [=11=]} // shows '(7 times)'

图像

这仅仅是演示文稿的结果:

21 //the result from the first time
(6 times) //the other 6 times

(7times) //all 7 times, including the 21 one.

它显示函数/表达式在该行被调用的次数:

由于调用表达式 (summer()) 在同一行,因此算作额外操作。因此,6 prints + 6 returns + 1 summer() = 13 次在该行发生的事情。

我确定我没有使用正确的术语,但这就是正在发生的事情。