[WIP] Procedural Modification for Rust #129
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add Procedural Modification techniques for Rust
The original SWE-smith work introduces a line of "Procedural Modification" techniques, where programmatic entities are converted into an AST. The AST is then randomly manipulated (e.g. changing an operator, inverting a condition, removing a condition), and the resulting AST is converted back into code to serve as a bug.
Procedural Modifications currently work for both Python and Golang. This is a WIP PR to make it work for Rust.
Typically, the steps to implement procedural modifications are as follows:
swesmith/bug_gen/adapters/<language>.pyhas the_analyze_propertiesfunction implemented. This function is what will take eachCodeEntityand assign to it one or moreCodePropertytags.swesmith/bug_gen/procedural/<language>/. You can see a number of existing examples for how this works. Each PM, defined as a class, takes in aCodeEntityand produces aBugRewriteobject.swesmith/bug_gen/procedural/<language>/__init__.py, create aMODIFIERS_<LANG>variable which points at a list of procedural modification classes. Then add the extension ->MODIFIERS_<LANG>map toMAP_EXT_TO_MODIFIERS.For this PR, the following have been implemented: