Repository navigation
Open
Labels
A-rustArea: Rust codeArea: Rust codeC-bugfixCategory: PR with bug fixCategory: PR with bug fixD-mediumExperience needed to fix: Medium / intermediateExperience needed to fix: Medium / intermediateP-help-wantedCall for participation: Good issues for third party contributorsCall for participation: Good issues for third party contributorsS-needs-triageStatus: Needs to be labelledStatus: Needs to be labelled
Description
Description
In some cases, validation raises an error claiming that a hugr contains a type mismatch due to a node with signature: [] -> [], which is misleading and untrue
Steps to Reproduce
Here's an example that produces the error when imported and validated
(hugr 0)
(mod)
(define-func public
example.cond
(core.fn
[(core.adt [[(arithmetic.int.types.int 6)] [(arithmetic.int.types.int 6)]]) (arithmetic.int.types.int 6)]
[(arithmetic.int.types.int 6)])
(dfg [%0 %1] [%2]
(signature
(core.fn
[(core.adt [[(arithmetic.int.types.int 6)] [(arithmetic.int.types.int 6)]]) (arithmetic.int.types.int 6)]
[(arithmetic.int.types.int 6)]))
(cond [%0 %1] [%2]
(signature
(core.fn
[(core.adt [[(arithmetic.int.types.int 6)] [(arithmetic.int.types.int 6)]])]
[(arithmetic.int.types.int 6)]))
(dfg [%3 %4] [%3]
(signature
(core.fn [(arithmetic.int.types.int 6) (arithmetic.int.types.int 6)] [(arithmetic.int.types.int 6)])))
(dfg [%5 %6] [%7]
(signature
(core.fn [(arithmetic.int.types.int 6) (arithmetic.int.types.int 6)] [(arithmetic.int.types.int 6)]))
((arithmetic.int.iadd 6) [%5 %6] [%7]
(signature
(core.fn
[(arithmetic.int.types.int 6) (arithmetic.int.types.int 6)]
[(arithmetic.int.types.int 6)])))))))Expected Behaviour
What is wrong with this hugr is that the signature of cond is wrong: it ignores the second argument (of type (arithmetic.int.types.int 6) that it inherits from the DFG
Actual Behaviour
I get the following error
Error: Package validation error.
Caused by:
0: An operation Conditional contains invalid children: Case 0 in a conditional has optype `Case : [] -> []`, which differs from the signature of Conditional container: [[int(6)]+[int(6)]] -> [int(6)]. In parent Node(4), child Node(5)
1: Case 0 in a conditional has optype `Case : [] -> []`, which differs from the signature of Conditional container: [[int(6)]+[int(6)]] -> [int(6)]
which is lies??
Metadata
Metadata
Assignees
Labels
A-rustArea: Rust codeArea: Rust codeC-bugfixCategory: PR with bug fixCategory: PR with bug fixD-mediumExperience needed to fix: Medium / intermediateExperience needed to fix: Medium / intermediateP-help-wantedCall for participation: Good issues for third party contributorsCall for participation: Good issues for third party contributorsS-needs-triageStatus: Needs to be labelledStatus: Needs to be labelled
Activity