Skip to content

Commit 5f4cd41

Browse files
Michel Weststratefacebook-github-bot
Michel Weststrate
authored andcommitted
add feature flag ExpressionTreeShapeCreation
Summary: Per parent diff review, introduced `expression_tree_shape_creation` feature flag to only support shape syntax in preview mode. Reviewed By: dlreeves Differential Revision: D68829046 fbshipit-source-id: 6d6247ef2925fc87c3bbdc9172beb0159614c2b2
1 parent 0783044 commit 5f4cd41

File tree

8 files changed

+16
-4
lines changed

8 files changed

+16
-4
lines changed

hphp/hack/src/options/experimental_features.ml

+2
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ type feature_name =
6666
| ExpressionTreeNestedBindings
6767
| LikeTypeHints
6868
| ShapeDestructure
69+
| ExpressionTreeShapeCreation
6970
[@@deriving eq, ord, show]
7071

7172
let feature_name_map =
@@ -108,6 +109,7 @@ let feature_name_map =
108109
("expression_tree_nested_bindings", ExpressionTreeNestedBindings);
109110
("like_type_hints", LikeTypeHints);
110111
("shape_destructure", ShapeDestructure);
112+
("expression_tree_shape_creation", ExpressionTreeShapeCreation);
111113
]
112114

113115
let feature_name_from_string s = SMap.find_opt s feature_name_map

hphp/hack/src/options/experimental_features.mli

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ type feature_name =
6060
| ExpressionTreeNestedBindings
6161
| LikeTypeHints
6262
| ShapeDestructure
63+
| ExpressionTreeShapeCreation
6364
[@@deriving eq, ord, show]
6465

6566
val feature_status_from_string : string -> feature_status option

hphp/hack/src/oxidized/gen/experimental_features.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// This source code is licensed under the MIT license found in the
44
// LICENSE file in the "hack" directory of this source tree.
55
//
6-
// @generated SignedSource<<9627bbf2ac863eec80ce4134d9c2b60f>>
6+
// @generated SignedSource<<bd2fad7e13f706aa5d3dcdc649b868e8>>
77
//
88
// To regenerate this file, run:
99
// hphp/hack/src/oxidized_regen.sh
@@ -114,6 +114,7 @@ pub enum FeatureName {
114114
ExpressionTreeNestedBindings,
115115
LikeTypeHints,
116116
ShapeDestructure,
117+
ExpressionTreeShapeCreation,
117118
}
118119
impl TrivialDrop for FeatureName {}
119120
arena_deserializer::impl_deserialize_in_arena!(FeatureName);

hphp/hack/src/oxidized/manual/experimental_features_impl.rs

+1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ impl FeatureName {
5151
ExpressionTreeNestedBindings => Unstable,
5252
LikeTypeHints => Unstable,
5353
ShapeDestructure => Unstable,
54+
ExpressionTreeShapeCreation => Preview,
5455
}
5556
}
5657

hphp/hack/src/parser/rust_parser_errors.rs

+3
Original file line numberDiff line numberDiff line change
@@ -3266,6 +3266,9 @@ impl<'a, State: 'a + Clone> ParserErrors<'a, State> {
32663266
}
32673267
}
32683268
ShapeExpression(x) => {
3269+
if self.context.active_expression_tree {
3270+
self.check_can_use_feature(node, &FeatureName::ExpressionTreeShapeCreation)
3271+
}
32693272
for f in syntax_to_list_no_separators(&x.fields).rev() {
32703273
self.invalid_shape_field_check(f)
32713274
}

hphp/hack/test/expr_tree_debug_print/shape_param.good.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?hh
2-
<<file:__EnableUnstableFeatures('expression_trees')>>
2+
<<file:__EnableUnstableFeatures('expression_trees', 'expression_tree_shape_creation')>>
33

44
function g(): void {
55
ExampleDsl`{

hphp/hack/test/expr_tree_debug_print/shape_param.good.php.exp

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
<?hh
2-
<<file: __EnableUnstableFeatures('expression_trees')>>
2+
<<file:
3+
__EnableUnstableFeatures(
4+
'expression_trees',
5+
'expression_tree_shape_creation',
6+
)>>
37

48
function g(): void {
59
ExampleDsl::makeTree(

hphp/test/slow/expression_trees/shape.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?hh
22

3-
<<file:__EnableUnstableFeatures('expression_trees')>>
3+
<<file:__EnableUnstableFeatures('expression_trees', 'expression_tree_shape_creation')>>
44

55
<<__EntryPoint>>
66
function test(): void {

0 commit comments

Comments
 (0)