Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[REVIEW] Introduce Field and FieldMetadata
This commit introduces new data structure for the implementation of RFC005: records don't just hold values anymore, but optional values togetehr with metadata. Simple adaptation are done right away, but more complex issues are postponed to future work. MetaValue are kept in parallel for the time being. [REVIEW] Adapt parser infrastrucure to Field Adapt the parser module to use the new type Field/FieldMetadata from RFC005. The grammar is also updated to generated them instead of using the old MetaValue. [NO REVIEW] Fix errors after dyn fields change We changed dynamic fields from RichTerm to Field, so that they can carry out their Metadata. This commit fixes some compilation errors related to that previous change. [REVIEW] Handling of `Annotated` AST node RFC005 will get rid of MetaValue altogether. It is split in metadata attached to fields (FieldMetadata), and contract and type annotations which can still appear anywhere, the new Annotated. This commits update various parts of the code to handle this new AST node. [REVIEW] handle LetMetadata, fix destructuring Let can still hold a `doc` item, hence the parser has now a new intermediate annotation (between FieldMetadata and Annotated): LetMetadata. This commits deal with it, and fix destructuring to work with the new RFC005 types. [NO REVIEW] Fix borrowing errors [REVIEW] Introduce new RuntimeError term Because of RFC005, missing field definition error are known in advance, and with better context, which is great. However, in some situation, they aren't necessary raised in the hand: for example if the field being treated is not used, we shouldn't raise the error. This commit adds a new term to the AST, RuntimeError, which is just a delayed error: if it is never evaluated, it's fine, but if the evaluator ecounters it, the error it contains is simply raised. [NO REVIEW] Fix typo [REVIEW] Update missing field def error for RFC005 [REVIEW] Propagate field through dynamic extension Now that we can't carry metadata around inside terms, the dynamic extension operator (or insertion operator) needs to perform some tricks to recover the metadata of the original field as well as handling field without definition. [NO REVIEW] Fill LetMetadata::combine [NO REVIEW] Fill MissingFieldError::into_eval_err [REVIEW] Typechecking Field and Annot Refactor a bit the typechecking code and fill missing implementations to andle fields and annotated terms more uniformly. [REVIEW] Implement merging for `Field` Make merging act on Fields instead of MetaValue. [NO REVIEW] Remove old TODOs, solve small ones [REVIEW] Fix iter_without_opts iter_without_opts didn't have the right semantics, as it was just ignoring all fields without definition, optional or not. [NO REVIEW] Fix pretty printing of dynamic fields [REVIEW] Field traversal Add a Traverse trait to structure a bit the big chunk of traverse functions implemented on various types, and implement Traverse for Field. [REVIEW] Update rec priorities for fields Adapt rec priorities operator to RFC005. For now, we try to maintain the old semantics. The price to pay is that we have to deep seq the terms to which the recursive priority is applied to. This is meant to evolve in later bikeshedding. [NO REVIEW] Updating done TODOs [NO REVIEW] Get rid of MetaValue type [REVIEW] Adapt query to FieldMetadata Since RFC005, quering just a value doesn't make anymore (random values don't have metadata). We have to query a field path from a specific record. This commit reworks the querying infrastructure to handle that. We recursively evaluate each element of the path to a record, until the last, from which we extract the corresponding field and access to the metadata. [NO REVIEW] Get rid of eval_mode and depr. doc [NO REVIEW] Get rid of compilation warnings [REVIEW] Fix recursion limit codegen error [REVIEW] Evaluation of annotated term As contract are still generated during the contract application phase, the evaluation of an annotated term just does nothing: it unwraps the underlying term. [NO REVIEW] Fix compilation errors in tests [REVIEW] Add missing contract app for fields Update the contract application transformation phase to also generate applications for the new record fields (Field) [NO REVIEW] Fix unbound identifier in merging [NO REVIEW] Fix unbound identifier in rec prio op [REVIEW] Disable tests after RFC005 One behavior hard to replicate with RFC005, because of how the metadata are stored now. We disable the test for now. [NO REVIEW] Fix bug in transforming dyn fields [NO REVIEW] Fix forcing versions of rec prio op [NO REVIEW] Remove empty lines from destruct tests [REVIEW] First phase of fixing merging Merging has become slightly more complex with RFC005. While everything (field value, contracts, etc.) was bundled in a MetaValue before, that you could closurize or revert as one entity, now there are many places where terms can lie: both in the field's value and the field's metadata. Those must be individually closurized, reverted, saturated, etc. [REVIEW] 2nd phase of fixing merging Follow-up of the previus commit to fix merging in the context of RFC005. In particular, the share_normal_form transformation is udpated to introduce revertible bindings for field's metadata as well, as the contract attached to one field may depend recursively on other fields of the same record. Various missing closurizing/revert/saturate are added as well. [REVIEW] Temporary work-around to fix a test ...while waiting for improvement of dictionary types (namely, that they are more "lazy") [REVIEW] Substitute wildcards in fields metadata Missing substitution of wildcards inside new FieldMetadata. [REVIEW] Fix parsing of doc as multiline strings [REVIEW] Fix pretty printing of standard strings [NO REVIEW] Update snapshots for pretty printing [REVIEW] Document RFC005 items, fix other doc [NO REVIEW] Add missing cache argument to merge helpers [REVIEW] Use a proper type for string rendering style [FORMAT] [REVIEW] Temporarily disable recursive priorities test [NO REVIEW] Update snapshots test for pretty printing [NO REVIEW] Fix missing import [NO REVIEW] Fix clippy errors [NO REVIEW] Post-rebase fixup [NO REVIEW] Fix the LSP for RFC005 [REVIEW] Fix typechecking of anotated terms Moving code around made the `walk_with_annot` function traversing terms with a static annotation two times, and the first in non strict mode. This would change the behavior of another statically typed code was present inside, as in the non-strict mode, all variables introduced in-between would be affected to `Dyn` (mostly). This might also mess up the LSP, as terms were added two times. [NO REVIEW] Fix context completion for chained record. Apply suggestions from code review Co-authored-by: Gaga <[email protected]> [DOC] add unwrap/unreachable justification [DOC] Fix typo [DOC] Add missing doc to helper function [NO REVIEW] Replace item with meta in `IdentWithType` We actually only need the metadata stored in the item to generate completion data; so keeping only the metadata is more efficient and easier to deal with. [NO REVIEW] Display completion data using `FieldMetadata` Update src/error.rs Co-authored-by: Viktor Kleen <[email protected]> Update src/transform/share_normal_form.rs Co-authored-by: Viktor Kleen <[email protected]> Update src/transform/share_normal_form.rs Co-authored-by: Viktor Kleen <[email protected]> Update src/eval/merge.rs Co-authored-by: Viktor Kleen <[email protected]> Update src/eval/merge.rs Co-authored-by: Viktor Kleen <[email protected]> Update src/eval/merge.rs Co-authored-by: Viktor Kleen <[email protected]> [TO SQUASH] Remove dead code/comment [NO REVIEW] Post-rebase fixup
- Loading branch information