Skip to content

Commit 5f65ecf

Browse files
committed
wip: Protocol Conformance Must Not Be Redundant
1 parent 552e849 commit 5f65ecf

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

swift-6-beta.docc/ReferenceManual/Declarations.md

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2336,18 +2336,9 @@ doSomething(with: oneAndTwo)
23362336

23372337
当在传递给 `doSomething(_:)` 的实例上调用 `log()` 时,自定义标题会从日志字符串中省略。
23382338

2339-
### Protocol Conformance Must Not Be Redundant
2340-
2341-
A concrete type can conform to a particular protocol only once.
2342-
Swift marks redundant protocol conformances as an error.
2343-
You're likely to encounter this kind of error
2344-
in two kinds of situations.
2345-
The first situation is when
2346-
you explicitly conform to the same protocol multiple times,
2347-
but with different requirements.
2348-
The second situation is when
2349-
you implicitly inherit from the same protocol multiple times.
2350-
These situations are discussed in the sections below.
2339+
### 协议的遵循不应冗余
2340+
2341+
具体类型只能遵从某个协议一次。Swift 会将多余的协议遵从标记为错误。你可能会在两种情况下遇到这种错误。第一种情况是,当你以不同的要求多次显式地遵从同一个协议。第二种情况是,当你多次隐式地继承同一个协议。以下部分将讨论这些情况。
23512342

23522343
#### Resolving Explicit Redundancy
23532344

0 commit comments

Comments
 (0)