aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dialyzer/test/small_SUITE_data/src/fun2ms.erl
diff options
context:
space:
mode:
authorHans Bolinder <[email protected]>2014-06-17 16:29:24 +0200
committerHans Bolinder <[email protected]>2014-06-17 16:29:24 +0200
commit9572b1c4615e9efc9a7ff53fafc9a32730ae45e4 (patch)
tree21bf2411cacb5513dc44632cc955134ee50b192c /lib/dialyzer/test/small_SUITE_data/src/fun2ms.erl
parent584fb6f256f02d48b3c0be9a9462fe7df1b1acb4 (diff)
parent805f9c89fc01220bc1bb0f27e1b68fd4eca688ba (diff)
downloadotp-9572b1c4615e9efc9a7ff53fafc9a32730ae45e4.tar.gz
otp-9572b1c4615e9efc9a7ff53fafc9a32730ae45e4.tar.bz2
otp-9572b1c4615e9efc9a7ff53fafc9a32730ae45e4.zip
Merge branch 'maint'
* maint: [dialyzer] Correct a doc bug introduced in 0b041238 [dialyzer] Use the option 'dialyzer' to control the compiler [dialyzer] Fix handling of literal records
Diffstat (limited to 'lib/dialyzer/test/small_SUITE_data/src/fun2ms.erl')
-rw-r--r--lib/dialyzer/test/small_SUITE_data/src/fun2ms.erl21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/dialyzer/test/small_SUITE_data/src/fun2ms.erl b/lib/dialyzer/test/small_SUITE_data/src/fun2ms.erl
new file mode 100644
index 0000000000..9e7df85e4c
--- /dev/null
+++ b/lib/dialyzer/test/small_SUITE_data/src/fun2ms.erl
@@ -0,0 +1,21 @@
+-module(fun2ms).
+-export([return/0]).
+-include_lib("stdlib/include/ms_transform.hrl").
+
+-record(snapshot, {id :: integer(), arg1 :: atom(), arg2 :: tuple()}).
+
+return() ->
+ TableId = ets:new(table, [public, {keypos, #snapshot.id}]),
+
+ ets:insert(TableId, [#snapshot{id = 1, arg1 = hard, arg2 = {1,2}},
+ #snapshot{id = 2, arg1 = rock, arg2 = {1,2}},
+ #snapshot{id = 3, arg1 = hallelujah, arg2 =
+ {1,2}}]),
+
+
+ Example = ets:fun2ms(
+ fun(#snapshot{id = Arg1, arg1 = Arg2}) ->
+ {Arg1, Arg2}
+ end),
+
+ ets:select(TableId, Example).