gpt4 book ai didi

swift - @_downgrade_exhaustivity_check Swift 私有(private)关键字是什么?

转载 作者:可可西里 更新时间:2023-11-01 00:39:01 24 4
gpt4 key购买 nike

在浏览 Swift 存储库时,我遇到了那个关键字。

这是什么意思?

例如,来自 Time.swift :

public enum DispatchTimeInterval : Equatable {
case seconds(Int)
case milliseconds(Int)
case microseconds(Int)
case nanoseconds(Int)
@_downgrade_exhaustivity_check
case never
}

最佳答案

实际的提交消息状态

Implement @_downgrade_exhaustivity_check

Dispatch requests the ability to add a new case, but to treat missing instances of that case in patterns as warnings instead of errors. It is still an error to make reference to the annotated case in at least one pattern then not cover the rest of the space, but it is not an error to omit the space of patterns referencing the case entirely.

This attribute is private and uglified to intentionally discourage its use outside just this one use case.

来源https://git.snooey.net/Mirrors/swift/commit/03527d9eec65324434011d23219e2bf7525642c6

关于swift - @_downgrade_exhaustivity_check Swift 私有(private)关键字是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51354070/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com