warp icon indicating copy to clipboard operation
warp copied to clipboard

InferType-changes

Open AlejandroLabourdette opened this issue 2 years ago • 1 comments

This PR is to solve all conflicts from the use of the new InferType class to get node's types. Infer Type and the current way to compute types using e parser over typeString node's property are not compatible and they can't exist together so this branch can only be merged once it's completed the transition.

Remaining errors Before the transition to Cairo 1, there were 7 behavior tests failing, some of them were caused by hard modifications to the AST that leave it in an inconsistent state that the former parser approach couldn't identify. Those AST modifications have a meaning if we have in mind the big picture and the last state of the transpiration, but in an immediate step it seams like an error. An example of those is the simulation of an or operation with a substraction of booleans (assuming false is 0 and true 1). A subtraction of two booleans have no semantic meaning.

These errors do not exist's anymore with the transition to Cairo 1 so was decided to go for the transition but with the new version we also lost all testing over the transpiled files. The final state of warp pass some of the behavior test but not all of them and until don't exist a test pool strong like the one for Cairo 0 it's not advised to merge this changes. The implementation of new features can be stuck by errors related to Infer Type if we merge these changes and could be hard to trace them back to this as a cause.

Known errors

  • typeOfLiterals returns a specific and narrower set of types, the logic over some of the assumption on the expected types must be changed. Handling literals is an open discussion #849
  • Can not Abi-encode mapping types. Warp create new function definitions along the transpiling process, It's common for inferType to compute the type of those func computing their signature. This is not always possible for the new functions.
  • safeGetNodeType with inferType return a specialized type, some cases were implemented thinking in a generalized type

AlejandroLabourdette avatar Feb 07 '23 18:02 AlejandroLabourdette

This pr is waiting for behaviour tests to be working on the Cairo 1.0 branch.

JorikSchellekens avatar Apr 07 '23 13:04 JorikSchellekens