the above code causes red_knot to panic, due to something a bit subtle:
- We query for the type of
C via infer_definition_types
- during this process we infer the type of
list[C]
- during that process we (correctly!) annotate the type of
list and stuff it in the inference expressions
- We then try to get the type of
C... and call infer_definition_types
This leads to C being infered of type Unknown thanks to infer_definition_types_cycle_recover, which is fine and great... but due to something I don't quite understand, the result of infer_definition_types_cycle_recover ends up being the final definition of infer_definition_types(C).
As a result we lose the inference on list! So later linting code that traverses the AST tries to look up the type of the list expression and blows up.
My understanding here is that the queries are like:
infer_definition_types(C) -> infer_definition_types(C)
--------------------------------------------------------
infer_definition_types(C) -> [C: Unknown]
--------------------------------------------------------
[C: ClassType (base: Unknown), expressions: {list} ]
but that future queries to the DB for infer_defintion_types(C) ends up returning [C: Unknown]. I have been reading the docs on salsa cycling a bit on this point to try and decipher what is going on here but maybe somebody else would have a better understanding of what can be done here.
the above code causes
red_knotto panic, due to something a bit subtle:Cviainfer_definition_typeslist[C]listand stuff it in the inference expressionsC... and callinfer_definition_typesThis leads to
Cbeing infered of typeUnknownthanks toinfer_definition_types_cycle_recover, which is fine and great... but due to something I don't quite understand, the result ofinfer_definition_types_cycle_recoverends up being the final definition ofinfer_definition_types(C).As a result we lose the inference on
list! So later linting code that traverses the AST tries to look up the type of thelistexpression and blows up.My understanding here is that the queries are like:
but that future queries to the DB for
infer_defintion_types(C)ends up returning[C: Unknown]. I have been reading the docs on salsa cycling a bit on this point to try and decipher what is going on here but maybe somebody else would have a better understanding of what can be done here.