Context.compile doesn't type-check callable arguments against the parameter type.
- Crate:
qsc_fir_transforms
- Panic: invariants.rs:1828, in
check_call_shape_matches_callee
- Stage / profile: callable compile (
Context.compile(callable, *args)), Base
- Message:
PostArgPromote/PostAll call invariant violation: Expr 9 has type Prim(Int) but callee Expr 10 returns Prim(Double)
from qdk import Context, TargetProfile
ctx = Context(target_profile=TargetProfile.Base)
ctx.eval("""
function DoubleFunc(x : Int) : Double {
0.5
}
operation NotFromFunc(f : Int -> Int) : Int {
let i = f(0);
~~~i
}
""")
# `DoubleFunc` is `Int -> Double`, but `NotFromFunc` expects `Int -> Int`.
ctx.compile(ctx.code.NotFromFunc, ctx.code.DoubleFunc)
Context.compiledoesn't type-check callable arguments against the parameter type.qsc_fir_transformscheck_call_shape_matches_calleeContext.compile(callable, *args)), BasePostArgPromote/PostAll call invariant violation: Expr 9 has type Prim(Int) but callee Expr 10 returns Prim(Double)