Diagnostic and cause
LinkVariadic parameter is not final
- Family
- topaz
- Phase
- check
- Code
TPZ5024
Cause and conditions
A variadic parameter must be the final parameter of its declaration or function type.
Related rule: Variadic parameter is not finalResponse
Move the variadic parameter to the end of the declaration or function type.
Source evidence
- compiler/crates/topaz_diag/src/explain.rs at
151141d7bb44· 730-738 - compiler/crates/topaz_self_frontend/topaz/parser/declarations_modules.tpz at
151141d7bb44· 149-182 - compiler/crates/topaz_self_frontend/topaz/checker/protocols_methods.tpz at
151141d7bb44· 1231-1278 - compiler/crates/topaz_self_frontend/topaz/checker/nominals.tpz at
151141d7bb44· 352-385 - compiler/crates/topaz_check/src/form/formation.rs at
151141d7bb44· 644-658
Compiler phase: check.
Compiler explanation: A variadic function type or parameter list puts the variadic slot before another slot.
Message templates are Pending. The explanation above is not an observed CLI message.
A variadic parameter must be the final parameter of its declaration or function type.
Variadic parameter is not final
A variadic parameter must be the final parameter of its declaration or function type.
Source evidence
- compiler/crates/topaz_self_frontend/topaz/parser/declarations_modules.tpz at
151141d7bb44· 149-182 - compiler/crates/topaz_self_frontend/topaz/checker/protocols_methods.tpz at
151141d7bb44· 1231-1278 - compiler/crates/topaz_self_frontend/topaz/checker/nominals.tpz at
151141d7bb44· 352-385 - compiler/crates/topaz_check/src/form/formation.rs at
151141d7bb44· 644-658
Response
LinkMove the variadic parameter to the end of the declaration or function type.
Reproduction and verification
LinkRejected program
Linkfunction tail(...values: int, last: int) -> int { last }
No stdout.
Expected result
Expected result
Rejection during check. Nonzero exit.
TPZ5024diagnostics-variadic-not-final
The required primary-location contract is Pending.
The intended rejection is recorded as an implementation limitation. A current SELF producer does not establish the diagnostic source location, so that location remains Pending.
Source evidence
- compiler/crates/topaz_self_frontend/topaz/parser/declarations_modules.tpz at
151141d7bb44· 149-182 - compiler/crates/topaz_self_frontend/topaz/checker/protocols_methods.tpz at
151141d7bb44· 1231-1278 - compiler/crates/topaz_self_frontend/topaz/checker/nominals.tpz at
151141d7bb44· 352-385 - compiler/crates/topaz_check/src/form/formation.rs at
151141d7bb44· 644-658
Repaired program
Linkfunction tail(last: int, ...values: int) -> int { last }
Expected result
Expected result
Checking accepts the program. Exit code 0.
The intended rejection is recorded as an implementation limitation. A current SELF producer does not establish the diagnostic source location, so that location remains Pending.
Source evidence
- compiler/crates/topaz_self_frontend/topaz/parser/declarations_modules.tpz at
151141d7bb44· 149-182 - compiler/crates/topaz_self_frontend/topaz/checker/protocols_methods.tpz at
151141d7bb44· 1231-1278 - compiler/crates/topaz_self_frontend/topaz/checker/nominals.tpz at
151141d7bb44· 352-385 - compiler/crates/topaz_check/src/form/formation.rs at
151141d7bb44· 644-658