From 01d670299f6ada2c1a56da93eeb63de0dbf39e00 Mon Sep 17 00:00:00 2001 From: Akos Hajdu Date: Thu, 5 Aug 2021 07:55:50 -0700 Subject: [PATCH] [erl-frontend] Parse typed record fields Summary: Previously the JSON parser only accepted record fields if they appeared directly under the record. With this change it is possible to have record fields wrapped into typed record fields. Reviewed By: mmarescotti Differential Revision: D30132727 fbshipit-source-id: eb9e928b2 --- infer/src/erlang/ErlangJsonParser.ml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/infer/src/erlang/ErlangJsonParser.ml b/infer/src/erlang/ErlangJsonParser.ml index d0a01c68e..826b0bc62 100644 --- a/infer/src/erlang/ErlangJsonParser.ml +++ b/infer/src/erlang/ErlangJsonParser.ml @@ -479,12 +479,14 @@ let to_function json : Ast.function_ option = unknown "function" json -let to_record_field json : Ast.record_field option = +let rec to_record_field json : Ast.record_field option = match json with | `List [`String "record_field"; _; `List [`String "atom"; _; `String field_name]; expr] -> Some {Ast.field_name; initializer_= to_expression expr} | `List [`String "record_field"; _; `List [`String "atom"; _; `String field_name]] -> Some {Ast.field_name; initializer_= None} + | `List [`String "typed_record_field"; inner_record_field; _] -> + to_record_field inner_record_field | _ -> unknown "record_field" json