Identity and cause
СсылкаTPZ5523
- Семейство
- topaz
- Этап
- check
- Код
TPZ5523
Причина и условия
Each type parameter names a resolved protocol identity once. Repeating that identity produces TPZ5523, including through namespace qualification or aliases. A distinct protocol declaration remains a different requirement even when another module gives it the same name.
Связанное правило · Repeated protocol bounds →Действия
A function declaration names the same protocol more than once in the bounds of one type parameter. The checker compares the protocol name together with the type-parameter index. Repetition on one parameter is distinct from using that protocol on two different parameters. It attaches TPZ5523 to the repeated bound.
Rejected example
СсылкаRepeated-bound example
Ссылкаfunction duplicate<T: Show + Show>(value: T) -> T {value}
Ожидаемый результат
Ожидаемый результат
Этап отклонения check. Ненулевой код завершения.
repeated-protocol-bound at
example.tpz:1:30
TPZ5523 points to the second Show at example.. Each later occurrence for the same type parameter is diagnosed. Checking continues, so other applicable diagnostics may also appear. Remove the repeated bound to correct this program. The earlier receipt predates the location assertion; CI must execute this revision.
Observed: The authored exit and diagnostic-cause assertions passed. The primary-location assertion and additional-diagnostics policy remain pending. Recorded with Topaz 5.21.3 in run 42147883818 at 2026-. Document source: 1d6f9265d918.
Fix
СсылкаKeep one occurrence of each required protocol. If additional, distinct protocols are required, retain those bounds. This correction removes repetition; the repaired example checks the complete program.
Repeated bound removed
Ссылкаfunction duplicate<T: Show>(value: T) -> T {value}
example.tpz: types-ok (1 module)
example.tpz: resolve-ok (1 module)
Ожидаемый результат
Ожидаемый результат
Проверка принимает программу. Код завершения 0.
Наблюдаемые утверждения · Пройдено · 5.21.3
Код завершения 0.
example.tpz: types-ok (1 module)example.tpz: resolve-ok (1 module)
Нет вывода ошибок.
- Пройдено · expected 0; observed 0
Acceptance of this corrected complete program is a separate check.
Observed: The authored assertions passed. Recorded with Topaz 5.21.3 in run 42147883818 at 2026-. Document source: 1d6f9265d918.
Verification
СсылкаThe examples reuse the exact source, independent expectations, and product observations shown in Functions and generics. The required primary location and additional-diagnostic policy remain Pending.
Related rules
СсылкаExported functions also have restrictions on exposing module-local protocols. Those are reported separately as TPZ5524 and are not repaired merely by removing duplicates.