File tree Expand file tree Collapse file tree 4 files changed +28
-2
lines changed
tests/codetoanalyze/erlang Expand file tree Collapse file tree 4 files changed +28
-2
lines changed Original file line number Diff line number Diff line change @@ -111,7 +111,7 @@ and simple_expression =
111111and expression = {location : location ; simple_expression : simple_expression }
112112
113113and qualifier =
114- | BitsGenerator of {pattern : expression ; expression : expression }
114+ | BitsGenerator of {pattern : expression ; expression : expression ; strict : bool }
115115 | Filter of expression
116116 | Generator of {pattern : expression ; expression : expression ; strict : bool }
117117 | MapGenerator of {pattern : association ; expression : expression ; strict : bool }
Original file line number Diff line number Diff line change @@ -508,7 +508,11 @@ and to_qualifier gen_uniq json : Ast.qualifier option =
508508 | `List [`String " b_generate" ; _anno; pattern; expression] ->
509509 let * pattern = to_expression gen_uniq pattern in
510510 let * expression = to_expression gen_uniq expression in
511- Some (Ast. BitsGenerator {pattern; expression})
511+ Some (Ast. BitsGenerator {pattern; expression; strict= false })
512+ | `List [`String " b_generate_strict" ; _anno; pattern; expression] ->
513+ let * pattern = to_expression gen_uniq pattern in
514+ let * expression = to_expression gen_uniq expression in
515+ Some (Ast. BitsGenerator {pattern; expression; strict= true })
512516 | `List [`String " generate" ; _anno; pattern; expression] ->
513517 let * pattern = to_expression gen_uniq pattern in
514518 let * expression = to_expression gen_uniq expression in
Original file line number Diff line number Diff line change @@ -70,6 +70,10 @@ features_arithmetic:test_uminus1_Ok/0: ok
7070features_arithmetic:test_uminus2_Bad/0: expected_crash
7171features_arithmetic:test_uminus2_Ok/0: ok
7272
73+ ----- features_bc -----
74+ features_bc:fn_test_strict_Bad/0: bad_generator
75+ features_bc:test_strict_Ok/0: ok
76+
7377----- features_binary_attr -----
7478features_binary_attr:test_bad_Bad/0: expected_crash
7579features_binary_attr:test_ok_Ok/0: ok
Original file line number Diff line number Diff line change 1+ % Copyright (c) Facebook, Inc. and its affiliates.
2+ %
3+ % This source code is licensed under the MIT license found in the
4+ % LICENSE file in the root directory of this source tree.
5+
6+ -module (features_bc ).
7+
8+ -export ([
9+ test_strict_Ok /0 ,
10+ fn_test_strict_Bad /0
11+ ]).
12+
13+ test_strict_Ok () ->
14+ [X || <<X >> < := <<1 >>].
15+
16+ % We don't support bitstring generators
17+ fn_test_strict_Bad () ->
18+ [X || <<X >> < := nope ].
You can’t perform that action at this time.
0 commit comments