swift 类中使用泛型报错

小弟刚刚学swift些了一段代码但是运行时报错感觉很迷惑,希望有人可以解惑什么地方错了:

 class Pushpop<T> {
    var items = [T]()
    func push(item:T) {
        items.append(item)
    }
    func pop() {
        items.removeLast()
    }

}
var stack = Pushpop<String>()
stack.push("things")
stack.push("other")
stack.pop()
stack.push("ss")
for item in stack.items {
    print(item)
}

图片说明

你在哪里运行的?我在playground上跑了一遍,无误。

xcode中的Command Line Tool工程

没有错误啊,这段代码!