Diagnostic and cause
LinkMalformed concurrent form
- Family
- topaz
- Phase
- parse
- Code
TPZ2005
Cause and conditions
A concurrent expression has an else block exactly when it has a timeout argument. Each arm has a name followed by : and an expression.
Response
Remove the else block for concurrent without a timeout. When selecting a timeout, write timeout: followed by a duration and provide an else block.
Source evidence
- compiler/crates/topaz_diag/src/explain.rs at
151141d7bb44· 256-264 - compiler/crates/topaz_self_frontend/topaz/parser/expressions.tpz at
151141d7bb44· 731-731 - compiler/crates/topaz_self_frontend/topaz/parser/expressions.tpz at
151141d7bb44· 722-778 - compiler/crates/topaz_self_frontend/topaz/parser/expressions.tpz at
151141d7bb44· 782-798 - compiler/crates/topaz_self_frontend/topaz/parser/expressions.tpz at
151141d7bb44· 844-871 - TPZ2005 at
151141d7bb44
Compiler phase: parse.
Compiler explanation: A concurrent timeout and else branch are not paired correctly.
Message templates. The marker ⟨value⟩ stands for text computed for the reported program.
concurrenttakes only atimeout:argument Sourceelserequires theconcurrent(timeout: .form Source. . ) - the
concurrent(timeout: .form requires an. . ) elseblock Source
The reproduction attaches an else block to concurrent without a timeout. The timeout form requires an else block, and the form without a timeout rejects one.
Trigger and repair
A concurrent expression has an else block exactly when it has a timeout argument. Each arm has a name followed by : and an expression.
Source evidence
- compiler/crates/topaz_self_frontend/topaz/parser/expressions.tpz at
151141d7bb44· 722-778 - compiler/crates/topaz_self_frontend/topaz/parser/expressions.tpz at
151141d7bb44· 782-798 - compiler/crates/topaz_self_frontend/topaz/parser/expressions.tpz at
151141d7bb44· 844-871 - TPZ2005 at
151141d7bb44
Response
LinkRemove the else block for concurrent without a timeout. When selecting a timeout, write timeout: followed by a duration and provide an else block.
Reproduction and verification
LinkRejected program
Linklet value = concurrent { first: 1 } else { 0 }
No stdout.
Expected result
The expected diagnostic, cause, source location, and accompanying diagnostics are specified below. The verification status records whether this program has been run.
Source evidence
- compiler/crates/topaz_diag/src/explain.rs at
151141d7bb44· 256-264 - compiler/crates/topaz_self_frontend/topaz/parser/expressions.tpz at
151141d7bb44· 731-731 - compiler/crates/topaz_self_frontend/topaz/parser/expressions.tpz at
151141d7bb44· 722-778 - compiler/crates/topaz_self_frontend/topaz/parser/expressions.tpz at
151141d7bb44· 782-798 - compiler/crates/topaz_self_frontend/topaz/parser/expressions.tpz at
151141d7bb44· 844-871 - TPZ2005 at
151141d7bb44
Corrected program
Linklet value = concurrent { first: 1 }
Expected result
Expected result
Checking accepts the program. Exit code 0.
This program applies the repair described above. The verification status records whether it has been run.
Source evidence
- compiler/crates/topaz_self_frontend/topaz/parser/expressions.tpz at
151141d7bb44· 722-778 - compiler/crates/topaz_self_frontend/topaz/parser/expressions.tpz at
151141d7bb44· 782-798 - compiler/crates/topaz_self_frontend/topaz/parser/expressions.tpz at
151141d7bb44· 844-871 - TPZ2005 at
151141d7bb44