@@ -70,6 +70,7 @@ module FullFidelityParseArgs = struct
7070 enable_class_level_where_clauses : bool ;
7171 disable_legacy_soft_typehints : bool ;
7272 disable_outside_dollar_str_interp : bool ;
73+ allow_new_attribute_syntax : bool ;
7374 }
7475
7576 let make
@@ -103,6 +104,7 @@ module FullFidelityParseArgs = struct
103104 enable_class_level_where_clauses
104105 disable_legacy_soft_typehints
105106 disable_outside_dollar_str_interp
107+ allow_new_attribute_syntax
106108 = {
107109 full_fidelity_json;
108110 full_fidelity_dot;
@@ -134,6 +136,7 @@ module FullFidelityParseArgs = struct
134136 enable_class_level_where_clauses;
135137 disable_legacy_soft_typehints;
136138 disable_outside_dollar_str_interp;
139+ allow_new_attribute_syntax;
137140 }
138141
139142 let parse_args () =
@@ -183,6 +186,7 @@ module FullFidelityParseArgs = struct
183186 let enable_class_level_where_clauses = ref false in
184187 let disable_legacy_soft_typehints = ref false in
185188 let disable_outside_dollar_str_interp = ref false in
189+ let allow_new_attribute_syntax = ref false in
186190 let options = [
187191 (* modes *)
188192 " --full-fidelity-json" ,
@@ -304,6 +308,9 @@ No errors are filtered out.";
304308 " --disable-outside-dollar-str-interp" ,
305309 Arg. Set disable_outside_dollar_str_interp,
306310 " Disables ${x} syntax for string interpolation (use {$x} instead)" ;
311+ " --allow-new-attribute-syntax" ,
312+ Arg. Set allow_new_attribute_syntax,
313+ " Allow the new @ attribute syntax (disables legacy soft typehints)" ;
307314 ] in
308315 Arg. parse options push_file usage;
309316 let modes = [
@@ -350,6 +357,7 @@ No errors are filtered out.";
350357 ! enable_class_level_where_clauses
351358 ! disable_legacy_soft_typehints
352359 ! disable_outside_dollar_str_interp
360+ ! allow_new_attribute_syntax
353361end
354362
355363open FullFidelityParseArgs
@@ -376,6 +384,7 @@ let handle_existing_file args filename =
376384 args.disable_legacy_soft_typehints in
377385 let popt = ParserOptions. with_disable_outside_dollar_str_interp popt
378386 args.disable_outside_dollar_str_interp in
387+ let popt = ParserOptions. with_allow_new_attribute_syntax popt args.allow_new_attribute_syntax in
379388
380389 (* Parse with the full fidelity parser *)
381390 let file = Relative_path. create Relative_path. Dummy filename in
@@ -385,6 +394,7 @@ let handle_existing_file args filename =
385394 ~disable_lval_as_an_expression: args.disable_lval_as_an_expression
386395 ~rust: args.rust
387396 ~disable_legacy_soft_typehints: args.disable_legacy_soft_typehints
397+ ~allow_new_attribute_syntax: args.allow_new_attribute_syntax
388398 ?mode () in
389399 let syntax_tree = SyntaxTree. make ~env source_text in
390400 let editable = SyntaxTransforms. editable_from_positioned syntax_tree in
0 commit comments