-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Erlang maps #183
Comments
Erlang maps ASTThis comment intends to serve as a reference of how map expressions and patterns match to Expressions (for
|
Map value expressionsSupport for generic map syntax (evaluate expressions and perform pattern matching) is implemented in #185, along with test coverage. The PR contains further details, but in general the implementation proposed in this issue was followed. Map specsSupport for parsing specs including map types is implemented in #184, along with test coverage. |
Support for maps standard libraryI am having quite a lot of trouble adding support for the maps standard library. Further, the As reference, I've been trying to add support for the ones where implementing in user-space code is possible, for example The diff above contains a new test case using Included here for clarity, the test case is: {
"module": "map",
"function": "fromlist",
"args": "[10,11]",
"depth": "30",
"errors": true,
"arity": 2,
"nondeterministic": true,
"xopts": "--disable-pmatch",
"solutions": [
"$2 == 0"
],
"skip": false
} and the function definition is -spec fromlist(atom(), integer()) -> float().
fromlist(X, Y) ->
Z = maps:from_list([{X, Y}]),
10 / maps:get(X, Z).
I suppose the output is parsable by people familiar with cuter internals. Judging from it, it looks like creating and breaking a symbolic value in cuter does not return the original pair of symbolic values (which does make sense for cuter in general, it logs all necessary constraints for the Z3 solver to handle). I would appreciate any pointers/help. |
Summary
Add support for Erlang maps in cuter. Cuter already contains some of the required machinery needed for supporting maps, but it currently crashes when parsing code that uses maps.
TODO
This is a rough TODO of things that are required for maps support:
map()
type in specs (in progress)c_map
andc_map_pair
AST nodes in concolic execution, as well as pattern matching (ref https://github.com/erlang/otp/blob/master/lib/compiler/src/core_parse.hrl#L75-L84). This mainly revolves around extendingeval_expr/
andpattern_match/
. (in progress)maps:get
,maps:put
, ...).Notes
WIP
Some early work is in https://github.com/neoaggelos/cuter/tree/maps-support
The text was updated successfully, but these errors were encountered: