// 故意编译失败:KeyPath 的类型决定可赋值的值类型。 // 复现:swiftc Diagnostics/KeyPathTypeMismatch.swift struct Point { var x = 0 } var point = Point() point[keyPath: \.x] = "one" print(point.x)