Skip to content

Commit c3f9983

Browse files
authored
flambda-backend: Expose Pprintast.tyvar (#1848)
1 parent 3782152 commit c3f9983

File tree

4 files changed

+12
-0
lines changed

4 files changed

+12
-0
lines changed

boot/ocamlc

1.45 KB
Binary file not shown.

parsing/pprintast.mli

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,8 @@ val payload: Format.formatter -> Parsetree.payload -> unit
5252

5353
val class_signature: Format.formatter -> Parsetree.class_signature -> unit
5454
val type_declaration: Format.formatter -> Parsetree.type_declaration -> unit
55+
56+
val tyvar: Format.formatter -> string -> unit
57+
(** Print a type variable name as a valid identifier, taking care of the
58+
special treatment required for the single quote character in second
59+
position, or for keywords by escaping them with \#. No-op on "_". *)

testsuite/tests/language-extensions/pprintast_unconditional.ml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ module Example = struct
7474
; ptype_attributes = []
7575
; ptype_loc = loc
7676
}
77+
let tyvar = "no_tyvars_require_extensions"
7778
end
7879

7980
let print_test_header name =
@@ -144,6 +145,8 @@ end = struct
144145

145146
let string_of_expression = test_string_of "string_of_expression" string_of_expression Example.expression
146147
let string_of_structure = test_string_of "string_of_structure" string_of_structure Example.structure
148+
149+
let tyvar = test "tyvar" tyvar Example.tyvar
147150
end
148151

149152

testsuite/tests/language-extensions/pprintast_unconditional.reference

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ string_of_expression: [x for x = 1 to 10]
5151

5252
string_of_structure: include functor F
5353

54+
tyvar: 'no_tyvars_require_extensions
55+
5456
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
5557

5658
##### Extensions disallowed
@@ -106,6 +108,8 @@ string_of_expression: [x for x = 1 to 10]
106108

107109
string_of_structure: include functor F
108110

111+
tyvar: 'no_tyvars_require_extensions
112+
109113
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
110114

111115
##### Calling [Language_extension.For_pprintast.make_printer_exporter ()]

0 commit comments

Comments
 (0)