ty icon indicating copy to clipboard operation
ty copied to clipboard

[panic] expression should belong to this 'UnpackResult' and 'Unpacker' should have inferred a type for it

Open correctmost opened this issue 8 months ago • 3 comments

Summary

ty crashes on this fuzzed code:

-a,f'{a}'=
error[panic]: Panicked at crates/ty_python_semantic/src/types/infer.rs:3529:26 when checking `c.py`: `expression should belong to this `UnpackResult` and `Unpacker` should have inferred a type for it`

Version

ty 0.0.1-alpha.8

correctmost avatar Jun 11 '25 03:06 correctmost

Thanks for the report!

It seems to be something around the fact that the variable that the f-string references is right there in the unpacking because changing that to some other variable removes the panic, so -a,f'{b}'= doesn't cause the panic.

dhruvmanila avatar Jun 11 '25 04:06 dhruvmanila

And, that the variable a isn't actually present in the unpack result because -a is an invalid expression so it doesn't contain any type for variable a. This (a, f'{a}' =) doesn't cause the panic because a should be present in the unpack result.

dhruvmanila avatar Jun 11 '25 04:06 dhruvmanila

Another example of this

for+x,p*x

MichaReiser avatar Dec 23 '25 07:12 MichaReiser