The unpac monorepo manager self-hosting as a monorepo using unpac
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Cleanups following introduction of `Pexp_struct_item`/`Texp_struct_item` (#14028)

* Remove stale comments

* Remove dead constructor: Scoping_let_module

* Remove eqparsetree.ml

authored by

Nicolás Ojeda Bär and committed by
GitHub
a086c20a e0154dc2

-820
-10
.depend
··· 8003 8003 bytecomp/bytesections.cmx \ 8004 8004 tools/dumpobj.cmi 8005 8005 tools/dumpobj.cmi : 8006 - tools/eqparsetree.cmo : \ 8007 - parsing/parsetree.cmi \ 8008 - parsing/longident.cmi \ 8009 - parsing/location.cmi \ 8010 - parsing/asttypes.cmi 8011 - tools/eqparsetree.cmx : \ 8012 - parsing/parsetree.cmi \ 8013 - parsing/longident.cmx \ 8014 - parsing/location.cmx \ 8015 - parsing/asttypes.cmx 8016 8006 tools/gen_sizeclasses.cmo : 8017 8007 tools/gen_sizeclasses.cmx : 8018 8008 tools/lintapidiff.cmo : \
-793
tools/eqparsetree.ml
··· 1 - (**************************************************************************) 2 - (* *) 3 - (* OCaml *) 4 - (* *) 5 - (* Hongbo Zhang (University of Pennsylvania) *) 6 - (* *) 7 - (* Copyright 2007 Institut National de Recherche en Informatique et *) 8 - (* en Automatique. *) 9 - (* *) 10 - (* All rights reserved. This file is distributed under the terms of *) 11 - (* the GNU Lesser General Public License version 2.1, with the *) 12 - (* special exception on linking described in the file LICENSE. *) 13 - (* *) 14 - (**************************************************************************) 15 - 16 - 17 - (* 18 - This module is mainly used to diff two parsetree, it helps to automate the 19 - test for parsing/pprintast.ml 20 - *) 21 - 22 - 23 - open Parsetree 24 - let curry f (g, h) = f g h 25 - let eq_int : (int*int)->bool = curry (=) 26 - let eq_char : (char*char)->bool=curry (=) 27 - let eq_string : (string*string)->bool = curry (=) 28 - let eq_int32 : (int32*int32)->bool=curry (=) 29 - let eq_int64 : (int64*int64)->bool =curry (=) 30 - let eq_nativeint : (nativeint*nativeint)->bool= curry (=) 31 - let eq_bool :(bool*bool) -> bool = curry (=) 32 - let eq_list mf_a (xs, ys) = 33 - let rec loop = 34 - function 35 - | ([], []) -> true 36 - | (x :: xs, y :: ys) -> (mf_a (x, y)) && (loop (xs, ys)) 37 - | (_, _) -> false 38 - in loop (xs, ys) 39 - let eq_option mf_a (x, y) = 40 - match (x, y) with 41 - | (None, None) -> true 42 - | (Some x, Some y) -> mf_a (x, y) 43 - | (_, _) -> false 44 - 45 - module Location =struct 46 - include Location 47 - let eq_t : (t*t) -> bool = fun (_,_) -> true 48 - end 49 - module Longident = struct 50 - include Longident 51 - let rec eq_t : (t * t) -> 'result = 52 - function 53 - | (Lident a0, Lident b0) -> eq_string (a0, b0) 54 - | (Ldot (a0, a1), Ldot (b0, b1)) -> 55 - (eq_t (a0, b0)) && (eq_string (a1, b1)) 56 - | (Lapply (a0, a1), Lapply (b0, b1)) -> 57 - (eq_t (a0, b0)) && (eq_t (a1, b1)) 58 - | (_, _) -> false 59 - end 60 - module Asttypes = struct 61 - open Asttypes 62 - let eq_constant : (constant * constant) -> 'result = 63 - fun (a, b) -> 64 - match a.pconst_desc, b.pconst_desc with 65 - | (Const_int a0, Const_int b0) -> eq_int (a0, b0) 66 - | (Const_char a0, Const_char b0) -> eq_char (a0, b0) 67 - | (Const_string a0, Const_string b0) -> eq_string (a0, b0) 68 - | (Const_float a0, Const_float b0) -> eq_string (a0, b0) 69 - | (Const_int32 a0, Const_int32 b0) -> eq_int32 (a0, b0) 70 - | (Const_int64 a0, Const_int64 b0) -> eq_int64 (a0, b0) 71 - | (Const_nativeint a0, Const_nativeint b0) -> eq_nativeint (a0, b0) 72 - | (_, _) -> false 73 - 74 - let eq_rec_flag : (rec_flag * rec_flag) -> 'result = 75 - function 76 - | (Nonrecursive, Nonrecursive) -> true 77 - | (Recursive, Recursive) -> true 78 - | (Default, Default) -> true 79 - | (_, _) -> false 80 - 81 - let eq_direction_flag : 82 - (direction_flag * direction_flag) -> 'result = 83 - function 84 - | (Upto, Upto) -> true 85 - | (Downto, Downto) -> true 86 - | (_, _) -> false 87 - 88 - let eq_private_flag : (private_flag * private_flag) -> 'result = 89 - function 90 - | (Private, Private) -> true 91 - | (Public, Public) -> true 92 - | (_, _) -> false 93 - 94 - let eq_mutable_flag : (mutable_flag * mutable_flag) -> 'result = 95 - function 96 - | (Immutable, Immutable) -> true 97 - | (Mutable, Mutable) -> true 98 - | (_, _) -> false 99 - 100 - let eq_virtual_flag : (virtual_flag * virtual_flag) -> 'result = 101 - function 102 - | (Virtual, Virtual) -> true 103 - | (Concrete, Concrete) -> true 104 - | (_, _) -> false 105 - 106 - let eq_override_flag : (override_flag * override_flag) -> 'result = 107 - function 108 - | (Override, Override) -> true 109 - | (Fresh, Fresh) -> true 110 - | (_, _) -> false 111 - 112 - let eq_closed_flag : (closed_flag * closed_flag) -> 'result = 113 - function 114 - | (Closed, Closed) -> true 115 - | (Open, Open) -> true 116 - | (_, _) -> false 117 - 118 - let eq_label : (label * label) -> 'result = 119 - fun (a0, a1) -> eq_string (a0, a1) 120 - 121 - let eq_loc : 122 - 'all_a0. 123 - (('all_a0 * 'all_a0) -> 'result) -> 124 - (('all_a0 loc) * ('all_a0 loc)) -> 'result = 125 - fun mf_a ({ txt = a0; loc = a1 }, { txt = b0; loc = b1 }) -> 126 - (mf_a (a0, b0)) && (Location.eq_t (a1, b1)) 127 - 128 - end 129 - 130 - let rec eq_row_field : (row_field * row_field) -> 'result = 131 - function 132 - | (Rtag (a0, a1, a2), Rtag (b0, b1, b2)) -> 133 - ((Asttypes.eq_label (a0, b0)) && (eq_bool (a1, b1))) && 134 - (eq_list eq_core_type (a2, b2)) 135 - | (Rinherit a0, Rinherit b0) -> eq_core_type (a0, b0) 136 - | (_, _) -> false 137 - and eq_core_field_desc : 138 - (core_field_desc * core_field_desc) -> 'result = 139 - function 140 - | (Pfield (a0, a1), Pfield (b0, b1)) -> 141 - (eq_string (a0, b0)) && (eq_core_type (a1, b1)) 142 - | (Pfield_var, Pfield_var) -> true 143 - | (_, _) -> false 144 - and eq_core_field_type : 145 - (core_field_type * core_field_type) -> 'result = 146 - fun 147 - ({ pfield_desc = a0; pfield_loc = a1 }, 148 - { pfield_desc = b0; pfield_loc = b1 }) 149 - -> (eq_core_field_desc (a0, b0)) && (Location.eq_t (a1, b1)) 150 - and eq_package_type : (package_type * package_type) -> 'result = 151 - fun (a0, a1) -> 152 - (fun ((a0, a1), (b0, b1)) -> 153 - (Asttypes.eq_loc Longident.eq_t (a0, b0)) && 154 - (eq_list 155 - (fun ((a0, a1), (b0, b1)) -> 156 - (Asttypes.eq_loc Longident.eq_t (a0, b0)) && 157 - (eq_core_type (a1, b1))) 158 - (a1, b1))) 159 - (a0, a1) 160 - and eq_core_type_desc : 161 - (core_type_desc * core_type_desc) -> 'result = 162 - function 163 - | (Ptyp_any, Ptyp_any) -> true 164 - | (Ptyp_var a0, Ptyp_var b0) -> eq_string (a0, b0) 165 - | (Ptyp_arrow (a0, a1, a2), Ptyp_arrow (b0, b1, b2)) -> 166 - ((Asttypes.eq_label (a0, b0)) && (eq_core_type (a1, b1))) && 167 - (eq_core_type (a2, b2)) 168 - | (Ptyp_tuple a0, Ptyp_tuple b0) -> eq_list eq_core_type (a0, b0) 169 - | (Ptyp_constr (a0, a1), Ptyp_constr (b0, b1)) -> 170 - (Asttypes.eq_loc Longident.eq_t (a0, b0)) && 171 - (eq_list eq_core_type (a1, b1)) 172 - | (Ptyp_object a0, Ptyp_object b0) -> 173 - eq_list eq_core_field_type (a0, b0) 174 - | (Ptyp_class (a0, a1, a2), Ptyp_class (b0, b1, b2)) -> 175 - ((Asttypes.eq_loc Longident.eq_t (a0, b0)) && 176 - (eq_list eq_core_type (a1, b1))) 177 - && (eq_list Asttypes.eq_label (a2, b2)) 178 - | (Ptyp_alias (a0, a1), Ptyp_alias (b0, b1)) -> 179 - (eq_core_type (a0, b0)) && (eq_string (a1.txt, b1.txt)) 180 - | (Ptyp_variant (a0, a1, a2), Ptyp_variant (b0, b1, b2)) -> 181 - ((eq_list eq_row_field (a0, b0)) && (eq_bool (a1, b1))) && 182 - (eq_option (eq_list Asttypes.eq_label) (a2, b2)) 183 - | (Ptyp_poly (a0, a1), Ptyp_poly (b0, b1)) -> 184 - (eq_list eq_string (a0, b0)) && (eq_core_type (a1, b1)) 185 - | (Ptyp_package a0, Ptyp_package b0) -> eq_package_type (a0, b0) 186 - | (_, _) -> false 187 - and eq_core_type : (core_type * core_type) -> 'result = 188 - fun 189 - ({ ptyp_desc = a0; ptyp_loc = a1 }, 190 - { ptyp_desc = b0; ptyp_loc = b1 }) 191 - -> (eq_core_type_desc (a0, b0)) && (Location.eq_t (a1, b1)) 192 - 193 - let eq_class_infos : 194 - 'all_a0. 195 - (('all_a0 * 'all_a0) -> 'result) -> 196 - (('all_a0 class_infos) * ('all_a0 class_infos)) -> 'result = 197 - fun mf_a 198 - ({ 199 - pci_virt = a0; 200 - pci_params = a1; 201 - pci_name = a2; 202 - pci_expr = a3; 203 - pci_variance = a4; 204 - pci_loc = a5 205 - }, 206 - { 207 - pci_virt = b0; 208 - pci_params = b1; 209 - pci_name = b2; 210 - pci_expr = b3; 211 - pci_variance = b4; 212 - pci_loc = b5 213 - }) 214 - -> 215 - (((((Asttypes.eq_virtual_flag (a0, b0)) && 216 - ((fun ((a0, a1), (b0, b1)) -> 217 - (eq_list (Asttypes.eq_loc eq_string) (a0, b0)) && 218 - (Location.eq_t (a1, b1))) 219 - (a1, b1))) 220 - && (Asttypes.eq_loc eq_string (a2, b2))) 221 - && (mf_a (a3, b3))) 222 - && 223 - (eq_list 224 - (fun ((a0, a1), (b0, b1)) -> 225 - (eq_bool (a0, b0)) && (eq_bool (a1, b1))) 226 - (a4, b4))) 227 - && (Location.eq_t (a5, b5)) 228 - 229 - let rec eq_pattern_desc : (pattern_desc * pattern_desc) -> 'result = 230 - function 231 - | (Ppat_any, Ppat_any) -> true 232 - | (Ppat_var a0, Ppat_var b0) -> Asttypes.eq_loc eq_string (a0, b0) 233 - | (Ppat_alias (a0, a1), Ppat_alias (b0, b1)) -> 234 - (eq_pattern (a0, b0)) && (Asttypes.eq_loc eq_string (a1, b1)) 235 - | (Ppat_constant a0, Ppat_constant b0) -> 236 - Asttypes.eq_constant (a0, b0) 237 - | (Ppat_tuple a0, Ppat_tuple b0) -> eq_list eq_pattern (a0, b0) 238 - | (Ppat_construct (a0, a1), Ppat_construct (b0, b1)) -> 239 - ((Asttypes.eq_loc Longident.eq_t (a0, b0)) && 240 - (eq_option eq_pattern (a1, b1))) 241 - | (Ppat_variant (a0, a1), Ppat_variant (b0, b1)) -> 242 - (Asttypes.eq_label (a0, b0)) && (eq_option eq_pattern (a1, b1)) 243 - | (Ppat_record (a0, a1), Ppat_record (b0, b1)) -> 244 - (eq_list 245 - (fun ((a0, a1), (b0, b1)) -> 246 - (Asttypes.eq_loc Longident.eq_t (a0, b0)) && 247 - (eq_pattern (a1, b1))) 248 - (a0, b0)) 249 - && (Asttypes.eq_closed_flag (a1, b1)) 250 - | (Ppat_array a0, Ppat_array b0) -> eq_list eq_pattern (a0, b0) 251 - | (Ppat_or (a0, a1), Ppat_or (b0, b1)) -> 252 - (eq_pattern (a0, b0)) && (eq_pattern (a1, b1)) 253 - | (Ppat_constraint (a0, a1), Ppat_constraint (b0, b1)) -> 254 - (eq_pattern (a0, b0)) && (eq_core_type (a1, b1)) 255 - | (Ppat_type a0, Ppat_type b0) -> 256 - Asttypes.eq_loc Longident.eq_t (a0, b0) 257 - | (Ppat_lazy a0, Ppat_lazy b0) -> eq_pattern (a0, b0) 258 - | (Ppat_unpack a0, Ppat_unpack b0) -> 259 - Asttypes.eq_loc eq_string (a0, b0) 260 - | (_, _) -> false 261 - and eq_pattern : (pattern * pattern) -> 'result = 262 - fun 263 - ({ ppat_desc = a0; ppat_loc = a1 }, 264 - { ppat_desc = b0; ppat_loc = b1 }) 265 - -> (eq_pattern_desc (a0, b0)) && (Location.eq_t (a1, b1)) 266 - 267 - let rec eq_structure_item_desc : 268 - (structure_item_desc * structure_item_desc) -> 'result = 269 - function 270 - | (Pstr_eval a0, Pstr_eval b0) -> eq_expression (a0, b0) 271 - | (Pstr_value (a0, a1), Pstr_value (b0, b1)) -> 272 - (Asttypes.eq_rec_flag (a0, b0)) && 273 - (eq_list 274 - (fun ((a0, a1), (b0, b1)) -> 275 - (eq_pattern (a0, b0)) && (eq_expression (a1, b1))) 276 - (a1, b1)) 277 - | (Pstr_primitive (a0, a1), Pstr_primitive (b0, b1)) -> 278 - (Asttypes.eq_loc eq_string (a0, b0)) && 279 - (eq_value_description (a1, b1)) 280 - | (Pstr_type (a0, a1), Pstr_type (b0, b1)) -> 281 - (Asttypes.eq_rec_flag (a0, b0)) && 282 - eq_list 283 - (fun ((a0, a1), (b0, b1)) -> 284 - (Asttypes.eq_loc eq_string (a0, b0)) && 285 - (eq_type_declaration (a1, b1))) 286 - (a1, b1) 287 - | (Pstr_exception (a0, a1), Pstr_exception (b0, b1)) -> 288 - (Asttypes.eq_loc eq_string (a0, b0)) && 289 - (eq_exception_declaration (a1, b1)) 290 - | (Pstr_exn_rebind (a0, a1), Pstr_exn_rebind (b0, b1)) -> 291 - (Asttypes.eq_loc eq_string (a0, b0)) && 292 - (Asttypes.eq_loc Longident.eq_t (a1, b1)) 293 - | (Pstr_module (a0, a1), Pstr_module (b0, b1)) -> 294 - (Asttypes.eq_loc eq_string (a0, b0)) && 295 - (eq_module_expr (a1, b1)) 296 - | (Pstr_recmodule a0, Pstr_recmodule b0) -> 297 - eq_list 298 - (fun ((a0, a1, a2), (b0, b1, b2)) -> 299 - ((Asttypes.eq_loc eq_string (a0, b0)) && 300 - (eq_module_type (a1, b1))) 301 - && (eq_module_expr (a2, b2))) 302 - (a0, b0) 303 - | (Pstr_modtype (a0, a1), Pstr_modtype (b0, b1)) -> 304 - (Asttypes.eq_loc eq_string (a0, b0)) && 305 - (eq_module_type (a1, b1)) 306 - | (Pstr_open a0, Pstr_open b0) -> 307 - Asttypes.eq_loc Longident.eq_t (a0, b0) 308 - | (Pstr_class a0, Pstr_class b0) -> 309 - eq_list eq_class_declaration (a0, b0) 310 - | (Pstr_class_type a0, Pstr_class_type b0) -> 311 - eq_list eq_class_type_declaration (a0, b0) 312 - | (Pstr_include a0, Pstr_include b0) -> eq_module_expr (a0, b0) 313 - | (_, _) -> false 314 - and eq_structure_item : 315 - (structure_item * structure_item) -> 'result = 316 - fun 317 - ({ pstr_desc = a0; pstr_loc = a1 }, 318 - { pstr_desc = b0; pstr_loc = b1 }) 319 - -> (eq_structure_item_desc (a0, b0)) && (Location.eq_t (a1, b1)) 320 - and eq_structure : (structure * structure) -> 'result = 321 - fun (a0, a1) -> eq_list eq_structure_item (a0, a1) 322 - and eq_module_expr_desc : 323 - (module_expr_desc * module_expr_desc) -> 'result = 324 - function 325 - | (Pmod_ident a0, Pmod_ident b0) -> 326 - Asttypes.eq_loc Longident.eq_t (a0, b0) 327 - | (Pmod_structure a0, Pmod_structure b0) -> eq_structure (a0, b0) 328 - | (Pmod_functor (a0, a1, a2), Pmod_functor (b0, b1, b2)) -> 329 - ((Asttypes.eq_loc eq_string (a0, b0)) && 330 - (eq_module_type (a1, b1))) 331 - && (eq_module_expr (a2, b2)) 332 - | (Pmod_apply (a0, a1), Pmod_apply (b0, b1)) -> 333 - (eq_module_expr (a0, b0)) && (eq_module_expr (a1, b1)) 334 - | (Pmod_constraint (a0, a1), Pmod_constraint (b0, b1)) -> 335 - (eq_module_expr (a0, b0)) && (eq_module_type (a1, b1)) 336 - | (Pmod_unpack a0, Pmod_unpack b0) -> eq_expression (a0, b0) 337 - | (_, _) -> false 338 - and eq_module_expr : (module_expr * module_expr) -> 'result = 339 - fun 340 - ({ pmod_desc = a0; pmod_loc = a1 }, 341 - { pmod_desc = b0; pmod_loc = b1 }) 342 - -> (eq_module_expr_desc (a0, b0)) && (Location.eq_t (a1, b1)) 343 - and eq_with_constraint : 344 - (with_constraint * with_constraint) -> 'result = 345 - function 346 - | (Pwith_type a0, Pwith_type b0) -> eq_type_declaration (a0, b0) 347 - | (Pwith_module a0, Pwith_module b0) -> 348 - Asttypes.eq_loc Longident.eq_t (a0, b0) 349 - | (Pwith_typesubst a0, Pwith_typesubst b0) -> 350 - eq_type_declaration (a0, b0) 351 - | (Pwith_modsubst a0, Pwith_modsubst b0) -> 352 - Asttypes.eq_loc Longident.eq_t (a0, b0) 353 - | (_, _) -> false 354 - and eq_modtype_declaration : 355 - (modtype_declaration * modtype_declaration) -> 'result = 356 - function 357 - | (Pmodtype_abstract, Pmodtype_abstract) -> true 358 - | (Pmodtype_manifest a0, Pmodtype_manifest b0) -> 359 - eq_module_type (a0, b0) 360 - | (_, _) -> false 361 - and eq_signature_item_desc : 362 - (signature_item_desc * signature_item_desc) -> 'result = 363 - function 364 - | (Psig_value (a0, a1), Psig_value (b0, b1)) -> 365 - (Asttypes.eq_loc eq_string (a0, b0)) && 366 - (eq_value_description (a1, b1)) 367 - | (Psig_type (a0, a1), Psig_type (b0, b1)) -> 368 - (Asttypes.eq_rec_flag (a0, b0)) && 369 - eq_list 370 - (fun ((a0, a1), (b0, b1)) -> 371 - (Asttypes.eq_loc eq_string (a0, b0)) && 372 - (eq_type_declaration (a1, b1))) 373 - (a1, b1) 374 - | (Psig_exception (a0, a1), Psig_exception (b0, b1)) -> 375 - (Asttypes.eq_loc eq_string (a0, b0)) && 376 - (eq_exception_declaration (a1, b1)) 377 - | (Psig_module (a0, a1), Psig_module (b0, b1)) -> 378 - (Asttypes.eq_loc eq_string (a0, b0)) && 379 - (eq_module_type (a1, b1)) 380 - | (Psig_recmodule a0, Psig_recmodule b0) -> 381 - eq_list 382 - (fun ((a0, a1), (b0, b1)) -> 383 - (Asttypes.eq_loc eq_string (a0, b0)) && 384 - (eq_module_type (a1, b1))) 385 - (a0, b0) 386 - | (Psig_modtype (a0, a1), Psig_modtype (b0, b1)) -> 387 - (Asttypes.eq_loc eq_string (a0, b0)) && 388 - (eq_modtype_declaration (a1, b1)) 389 - | (Psig_open a0, Psig_open b0) -> 390 - Asttypes.eq_loc Longident.eq_t (a0, b0) 391 - | (Psig_include a0, Psig_include b0) -> eq_module_type (a0, b0) 392 - | (Psig_class a0, Psig_class b0) -> 393 - eq_list eq_class_description (a0, b0) 394 - | (Psig_class_type a0, Psig_class_type b0) -> 395 - eq_list eq_class_type_declaration (a0, b0) 396 - | (_, _) -> false 397 - and eq_signature_item : 398 - (signature_item * signature_item) -> 'result = 399 - fun 400 - ({ psig_desc = a0; psig_loc = a1 }, 401 - { psig_desc = b0; psig_loc = b1 }) 402 - -> (eq_signature_item_desc (a0, b0)) && (Location.eq_t (a1, b1)) 403 - and eq_signature : (signature * signature) -> 'result = 404 - fun (a0, a1) -> eq_list eq_signature_item (a0, a1) 405 - and eq_module_type_desc : 406 - (module_type_desc * module_type_desc) -> 'result = 407 - function 408 - | (Pmty_ident a0, Pmty_ident b0) -> 409 - Asttypes.eq_loc Longident.eq_t (a0, b0) 410 - | (Pmty_signature a0, Pmty_signature b0) -> eq_signature (a0, b0) 411 - | (Pmty_functor (a0, a1, a2), Pmty_functor (b0, b1, b2)) -> 412 - ((Asttypes.eq_loc eq_string (a0, b0)) && 413 - (eq_module_type (a1, b1))) 414 - && (eq_module_type (a2, b2)) 415 - | (Pmty_with (a0, a1), Pmty_with (b0, b1)) -> 416 - (eq_module_type (a0, b0)) && 417 - (eq_list 418 - (fun ((a0, a1), (b0, b1)) -> 419 - (Asttypes.eq_loc Longident.eq_t (a0, b0)) && 420 - (eq_with_constraint (a1, b1))) 421 - (a1, b1)) 422 - | (Pmty_typeof a0, Pmty_typeof b0) -> eq_module_expr (a0, b0) 423 - | (_, _) -> false 424 - and eq_module_type : (module_type * module_type) -> 'result = 425 - fun 426 - ({ pmty_desc = a0; pmty_loc = a1 }, 427 - { pmty_desc = b0; pmty_loc = b1 }) 428 - -> (eq_module_type_desc (a0, b0)) && (Location.eq_t (a1, b1)) 429 - and eq_class_declaration : 430 - (class_declaration * class_declaration) -> 'result = 431 - fun (a0, a1) -> eq_class_infos eq_class_expr (a0, a1) 432 - and eq_class_field_desc : 433 - (class_field_desc * class_field_desc) -> 'result = 434 - function 435 - | (Pcf_inher (a0, a1, a2), Pcf_inher (b0, b1, b2)) -> 436 - ((Asttypes.eq_override_flag (a0, b0)) && 437 - (eq_class_expr (a1, b1))) 438 - && (eq_option eq_string (a2, b2)) 439 - | (Pcf_valvirt a0, Pcf_valvirt b0) -> 440 - (fun ((a0, a1, a2), (b0, b1, b2)) -> 441 - ((Asttypes.eq_loc eq_string (a0, b0)) && 442 - (Asttypes.eq_mutable_flag (a1, b1))) 443 - && (eq_core_type (a2, b2))) 444 - (a0, b0) 445 - | (Pcf_val a0, Pcf_val b0) -> 446 - (fun ((a0, a1, a2, a3), (b0, b1, b2, b3)) -> 447 - (((Asttypes.eq_loc eq_string (a0, b0)) && 448 - (Asttypes.eq_mutable_flag (a1, b1))) 449 - && (Asttypes.eq_override_flag (a2, b2))) 450 - && (eq_expression (a3, b3))) 451 - (a0, b0) 452 - | (Pcf_virt a0, Pcf_virt b0) -> 453 - (fun ((a0, a1, a2), (b0, b1, b2)) -> 454 - ((Asttypes.eq_loc eq_string (a0, b0)) && 455 - (Asttypes.eq_private_flag (a1, b1))) 456 - && (eq_core_type (a2, b2))) 457 - (a0, b0) 458 - | (Pcf_meth a0, Pcf_meth b0) -> 459 - (fun ((a0, a1, a2, a3), (b0, b1, b2, b3)) -> 460 - (((Asttypes.eq_loc eq_string (a0, b0)) && 461 - (Asttypes.eq_private_flag (a1, b1))) 462 - && (Asttypes.eq_override_flag (a2, b2))) 463 - && (eq_expression (a3, b3))) 464 - (a0, b0) 465 - | (Pcf_constr a0, Pcf_constr b0) -> 466 - (fun ((a0, a1), (b0, b1)) -> 467 - (eq_core_type (a0, b0)) && (eq_core_type (a1, b1))) 468 - (a0, b0) 469 - | (Pcf_init a0, Pcf_init b0) -> eq_expression (a0, b0) 470 - | (_, _) -> false 471 - and eq_class_field : (class_field * class_field) -> 'result = 472 - fun 473 - ({ pcf_desc = a0; pcf_loc = a1 }, { pcf_desc = b0; pcf_loc = b1 474 - }) 475 - -> (eq_class_field_desc (a0, b0)) && (Location.eq_t (a1, b1)) 476 - and eq_class_structure : 477 - (class_structure * class_structure) -> 'result = 478 - fun 479 - ({ pcstr_self = a0; pcstr_fields = a1 }, 480 - { pcstr_self = b0; pcstr_fields = b1 }) 481 - -> (eq_pattern (a0, b0)) && (eq_list eq_class_field (a1, b1)) 482 - and eq_class_expr_desc : 483 - (class_expr_desc * class_expr_desc) -> 'result = 484 - function 485 - | (Pcl_constr (a0, a1), Pcl_constr (b0, b1)) -> 486 - (Asttypes.eq_loc Longident.eq_t (a0, b0)) && 487 - (eq_list eq_core_type (a1, b1)) 488 - | (Pcl_structure a0, Pcl_structure b0) -> 489 - eq_class_structure (a0, b0) 490 - | (Pcl_fun (a0, a1, a2, a3), Pcl_fun (b0, b1, b2, b3)) -> 491 - (((Asttypes.eq_label (a0, b0)) && 492 - (eq_option eq_expression (a1, b1))) 493 - && (eq_pattern (a2, b2))) 494 - && (eq_class_expr (a3, b3)) 495 - | (Pcl_apply (a0, a1), Pcl_apply (b0, b1)) -> 496 - (eq_class_expr (a0, b0)) && 497 - (eq_list 498 - (fun ((a0, a1), (b0, b1)) -> 499 - (Asttypes.eq_label (a0, b0)) && 500 - (eq_expression (a1, b1))) 501 - (a1, b1)) 502 - | (Pcl_let (a0, a1, a2), Pcl_let (b0, b1, b2)) -> 503 - ((Asttypes.eq_rec_flag (a0, b0)) && 504 - (eq_list 505 - (fun ((a0, a1), (b0, b1)) -> 506 - (eq_pattern (a0, b0)) && (eq_expression (a1, b1))) 507 - (a1, b1))) 508 - && (eq_class_expr (a2, b2)) 509 - | (Pcl_constraint (a0, a1), Pcl_constraint (b0, b1)) -> 510 - (eq_class_expr (a0, b0)) && (eq_class_type (a1, b1)) 511 - | (_, _) -> false 512 - and eq_class_expr : (class_expr * class_expr) -> 'result = 513 - fun 514 - ({ pcl_desc = a0; pcl_loc = a1 }, { pcl_desc = b0; pcl_loc = b1 515 - }) 516 - -> (eq_class_expr_desc (a0, b0)) && (Location.eq_t (a1, b1)) 517 - and eq_class_type_declaration : 518 - (class_type_declaration * class_type_declaration) -> 'result = 519 - fun (a0, a1) -> eq_class_infos eq_class_type (a0, a1) 520 - and eq_class_description : 521 - (class_description * class_description) -> 'result = 522 - fun (a0, a1) -> eq_class_infos eq_class_type (a0, a1) 523 - and eq_class_type_field_desc : 524 - (class_type_field_desc * class_type_field_desc) -> 'result = 525 - function 526 - | (Pctf_inher a0, Pctf_inher b0) -> eq_class_type (a0, b0) 527 - | (Pctf_val a0, Pctf_val b0) -> 528 - (fun ((a0, a1, a2, a3), (b0, b1, b2, b3)) -> 529 - (((eq_string (a0, b0)) && 530 - (Asttypes.eq_mutable_flag (a1, b1))) 531 - && (Asttypes.eq_virtual_flag (a2, b2))) 532 - && (eq_core_type (a3, b3))) 533 - (a0, b0) 534 - | (Pctf_virt a0, Pctf_virt b0) -> 535 - (fun ((a0, a1, a2), (b0, b1, b2)) -> 536 - ((eq_string (a0, b0)) && (Asttypes.eq_private_flag (a1, b1))) 537 - && (eq_core_type (a2, b2))) 538 - (a0, b0) 539 - | (Pctf_meth a0, Pctf_meth b0) -> 540 - (fun ((a0, a1, a2), (b0, b1, b2)) -> 541 - ((eq_string (a0, b0)) && (Asttypes.eq_private_flag (a1, b1))) 542 - && (eq_core_type (a2, b2))) 543 - (a0, b0) 544 - | (Pctf_cstr a0, Pctf_cstr b0) -> 545 - (fun ((a0, a1), (b0, b1)) -> 546 - (eq_core_type (a0, b0)) && (eq_core_type (a1, b1))) 547 - (a0, b0) 548 - | (_, _) -> false 549 - and eq_class_type_field : 550 - (class_type_field * class_type_field) -> 'result = 551 - fun 552 - ({ pctf_desc = a0; pctf_loc = a1 }, 553 - { pctf_desc = b0; pctf_loc = b1 }) 554 - -> 555 - (eq_class_type_field_desc (a0, b0)) && (Location.eq_t (a1, b1)) 556 - and eq_class_signature : 557 - (class_signature * class_signature) -> 'result = 558 - fun 559 - ({ pcsig_self = a0; pcsig_fields = a1; pcsig_loc = a2 }, 560 - { pcsig_self = b0; pcsig_fields = b1; pcsig_loc = b2 }) 561 - -> 562 - ((eq_core_type (a0, b0)) && 563 - (eq_list eq_class_type_field (a1, b1))) 564 - && (Location.eq_t (a2, b2)) 565 - and eq_class_type_desc : 566 - (class_type_desc * class_type_desc) -> 'result = 567 - function 568 - | (Pcty_constr (a0, a1), Pcty_constr (b0, b1)) -> 569 - (Asttypes.eq_loc Longident.eq_t (a0, b0)) && 570 - (eq_list eq_core_type (a1, b1)) 571 - | (Pcty_signature a0, Pcty_signature b0) -> 572 - eq_class_signature (a0, b0) 573 - | (Pcty_arrow (a0, a1, a2), Pcty_arrow (b0, b1, b2)) -> 574 - ((Asttypes.eq_label (a0, b0)) && (eq_core_type (a1, b1))) && 575 - (eq_class_type (a2, b2)) 576 - | (_, _) -> false 577 - and eq_class_type : (class_type * class_type) -> 'result = 578 - fun 579 - ({ pcty_desc = a0; pcty_loc = a1 }, 580 - { pcty_desc = b0; pcty_loc = b1 }) 581 - -> (eq_class_type_desc (a0, b0)) && (Location.eq_t (a1, b1)) 582 - and eq_exception_declaration : 583 - (exception_declaration * exception_declaration) -> 'result = 584 - fun (a0, a1) -> eq_list eq_core_type (a0, a1) 585 - and eq_type_kind : (type_kind * type_kind) -> 'result = 586 - function 587 - | (Ptype_abstract, Ptype_abstract) -> true 588 - | (Ptype_variant a0, Ptype_variant b0) -> 589 - eq_list 590 - (fun ((a0, a1, a2, a3), (b0, b1, b2, b3)) -> 591 - (((Asttypes.eq_loc eq_string (a0, b0)) && 592 - (eq_list eq_core_type (a1, b1))) 593 - && (eq_option eq_core_type (a2, b2))) 594 - && (Location.eq_t (a3, b3))) 595 - (a0, b0) 596 - | (Ptype_record a0, Ptype_record b0) -> 597 - eq_list 598 - (fun ((a0, a1, a2, a3), (b0, b1, b2, b3)) -> 599 - (((Asttypes.eq_loc eq_string (a0, b0)) && 600 - (Asttypes.eq_mutable_flag (a1, b1))) 601 - && (eq_core_type (a2, b2))) 602 - && (Location.eq_t (a3, b3))) 603 - (a0, b0) 604 - | (_, _) -> false 605 - and eq_type_declaration : 606 - (type_declaration * type_declaration) -> 'result = 607 - fun 608 - ({ 609 - ptype_params = a0; 610 - ptype_cstrs = a1; 611 - ptype_kind = a2; 612 - ptype_private = a3; 613 - ptype_manifest = a4; 614 - ptype_variance = a5; 615 - ptype_loc = a6 616 - }, 617 - { 618 - ptype_params = b0; 619 - ptype_cstrs = b1; 620 - ptype_kind = b2; 621 - ptype_private = b3; 622 - ptype_manifest = b4; 623 - ptype_variance = b5; 624 - ptype_loc = b6 625 - }) 626 - -> 627 - ((((((eq_list (eq_option (Asttypes.eq_loc eq_string)) (a0, b0)) 628 - && 629 - (eq_list 630 - (fun ((a0, a1, a2), (b0, b1, b2)) -> 631 - ((eq_core_type (a0, b0)) && (eq_core_type (a1, b1))) 632 - && (Location.eq_t (a2, b2))) 633 - (a1, b1))) 634 - && (eq_type_kind (a2, b2))) 635 - && (Asttypes.eq_private_flag (a3, b3))) 636 - && (eq_option eq_core_type (a4, b4))) 637 - && 638 - (eq_list 639 - (fun ((a0, a1), (b0, b1)) -> 640 - (eq_bool (a0, b0)) && (eq_bool (a1, b1))) 641 - (a5, b5))) 642 - && (Location.eq_t (a6, b6)) 643 - and eq_value_description : 644 - (value_description * value_description) -> 'result = 645 - fun 646 - ({ pval_type = a0; pval_prim = a1; pval_loc = a2 }, 647 - { pval_type = b0; pval_prim = b1; pval_loc = b2 }) 648 - -> 649 - ((eq_core_type (a0, b0)) && (eq_list eq_string (a1, b1))) && 650 - (Location.eq_t (a2, b2)) 651 - and eq_expression_desc : 652 - (expression_desc * expression_desc) -> 'result = 653 - function 654 - | (Pexp_ident a0, Pexp_ident b0) -> 655 - Asttypes.eq_loc Longident.eq_t (a0, b0) 656 - | (Pexp_constant a0, Pexp_constant b0) -> 657 - Asttypes.eq_constant (a0, b0) 658 - | (Pexp_let (a0, a1, a2), Pexp_let (b0, b1, b2)) -> 659 - ((Asttypes.eq_rec_flag (a0, b0)) && 660 - (eq_list 661 - (fun ((a0, a1), (b0, b1)) -> 662 - (eq_pattern (a0, b0)) && (eq_expression (a1, b1))) 663 - (a1, b1))) 664 - && (eq_expression (a2, b2)) 665 - | Pexp_fun (a1, a1, a2, a3), Pexp_function (b0, b1, b2, b3) -> 666 - ((Asttypes.eq_label (a0, b0)) && 667 - (eq_option eq_expression (a1, b1)) && 668 - (eq_pattern a2 b2) && 669 - (eq_expression (a3, b3))) 670 - | (Pexp_function (a0, a1, a2), Pexp_function (b0, b1, b2)) -> 671 - (* FIX *) 672 - eq_list 673 - (fun ((a0, a1), (b0, b1)) -> 674 - (eq_pattern (a0, b0)) && (eq_expression (a1, b1))) 675 - (a2, b2) 676 - | (Pexp_apply (a0, a1), Pexp_apply (b0, b1)) -> 677 - (eq_expression (a0, b0)) && 678 - (eq_list 679 - (fun ((a0, a1), (b0, b1)) -> 680 - (Asttypes.eq_label (a0, b0)) && 681 - (eq_expression (a1, b1))) 682 - (a1, b1)) 683 - | (Pexp_match (a0, a1), Pexp_match (b0, b1)) -> 684 - (eq_expression (a0, b0)) && 685 - (eq_list 686 - (fun ((a0, a1), (b0, b1)) -> 687 - (eq_pattern (a0, b0)) && (eq_expression (a1, b1))) 688 - (a1, b1)) 689 - | (Pexp_try (a0, a1), Pexp_try (b0, b1)) -> 690 - (eq_expression (a0, b0)) && 691 - (eq_list 692 - (fun ((a0, a1), (b0, b1)) -> 693 - (eq_pattern (a0, b0)) && (eq_expression (a1, b1))) 694 - (a1, b1)) 695 - | (Pexp_tuple a0, Pexp_tuple b0) -> eq_list eq_expression (a0, b0) 696 - | (Pexp_construct (a0, a1), Pexp_construct (b0, b1)) -> 697 - ((Asttypes.eq_loc Longident.eq_t (a0, b0)) && 698 - (eq_option eq_expression (a1, b1))) 699 - | (Pexp_variant (a0, a1), Pexp_variant (b0, b1)) -> 700 - (Asttypes.eq_label (a0, b0)) && 701 - (eq_option eq_expression (a1, b1)) 702 - | (Pexp_record (a0, a1), Pexp_record (b0, b1)) -> 703 - (eq_list 704 - (fun ((a0, a1), (b0, b1)) -> 705 - (Asttypes.eq_loc Longident.eq_t (a0, b0)) && 706 - (eq_expression (a1, b1))) 707 - (a0, b0)) 708 - && (eq_option eq_expression (a1, b1)) 709 - | (Pexp_field (a0, a1), Pexp_field (b0, b1)) -> 710 - (eq_expression (a0, b0)) && 711 - (Asttypes.eq_loc Longident.eq_t (a1, b1)) 712 - | (Pexp_setfield (a0, a1, a2), Pexp_setfield (b0, b1, b2)) -> 713 - ((eq_expression (a0, b0)) && 714 - (Asttypes.eq_loc Longident.eq_t (a1, b1))) 715 - && (eq_expression (a2, b2)) 716 - | (Pexp_array a0, Pexp_array b0) -> eq_list eq_expression (a0, b0) 717 - | (Pexp_ifthenelse (a0, a1, a2), Pexp_ifthenelse (b0, b1, b2)) -> 718 - ((eq_expression (a0, b0)) && (eq_expression (a1, b1))) && 719 - (eq_option eq_expression (a2, b2)) 720 - | (Pexp_sequence (a0, a1), Pexp_sequence (b0, b1)) -> 721 - (eq_expression (a0, b0)) && (eq_expression (a1, b1)) 722 - | (Pexp_while (a0, a1), Pexp_while (b0, b1)) -> 723 - (eq_expression (a0, b0)) && (eq_expression (a1, b1)) 724 - | (Pexp_for (a0, a1, a2, a3, a4), Pexp_for (b0, b1, b2, b3, b4)) -> 725 - ((((Asttypes.eq_loc eq_string (a0, b0)) && 726 - (eq_expression (a1, b1))) 727 - && (eq_expression (a2, b2))) 728 - && (Asttypes.eq_direction_flag (a3, b3))) 729 - && (eq_expression (a4, b4)) 730 - | (Pexp_constraint (a0, a1, a2), Pexp_constraint (b0, b1, b2)) -> 731 - ((eq_expression (a0, b0)) && (eq_option eq_core_type (a1, b1))) 732 - && (eq_option eq_core_type (a2, b2)) 733 - | (Pexp_when (a0, a1), Pexp_when (b0, b1)) -> 734 - (eq_expression (a0, b0)) && (eq_expression (a1, b1)) 735 - | (Pexp_send (a0, a1), Pexp_send (b0, b1)) -> 736 - (eq_expression (a0, b0)) && (eq_string (a1, b1)) 737 - | (Pexp_new a0, Pexp_new b0) -> 738 - Asttypes.eq_loc Longident.eq_t (a0, b0) 739 - | (Pexp_setinstvar (a0, a1), Pexp_setinstvar (b0, b1)) -> 740 - (Asttypes.eq_loc eq_string (a0, b0)) && 741 - (eq_expression (a1, b1)) 742 - | (Pexp_override a0, Pexp_override b0) -> 743 - eq_list 744 - (fun ((a0, a1), (b0, b1)) -> 745 - (Asttypes.eq_loc eq_string (a0, b0)) && 746 - (eq_expression (a1, b1))) 747 - (a0, b0) 748 - | (Pexp_letmodule (a0, a1, a2), Pexp_letmodule (b0, b1, b2)) -> 749 - ((Asttypes.eq_loc eq_string (a0, b0)) && 750 - (eq_module_expr (a1, b1))) 751 - && (eq_expression (a2, b2)) 752 - | (Pexp_assert a0, Pexp_assert b0) -> eq_expression (a0, b0) 753 - | (Pexp_lazy a0, Pexp_lazy b0) -> eq_expression (a0, b0) 754 - | (Pexp_poly (a0, a1), Pexp_poly (b0, b1)) -> 755 - (eq_expression (a0, b0)) && (eq_option eq_core_type (a1, b1)) 756 - | (Pexp_object a0, Pexp_object b0) -> eq_class_structure (a0, b0) 757 - | (Pexp_newtype (a0, a1), Pexp_newtype (b0, b1)) -> 758 - (eq_string (a0, b0)) && (eq_expression (a1, b1)) 759 - | (Pexp_pack a0, Pexp_pack b0) -> eq_module_expr (a0, b0) 760 - | (Pexp_open (a0, a1), Pexp_open (b0, b1)) -> 761 - (Asttypes.eq_loc Longident.eq_t (a0, b0)) && 762 - (eq_expression (a1, b1)) 763 - | (_, _) -> false 764 - and eq_expression : (expression * expression) -> 'result = 765 - fun 766 - ({ pexp_desc = a0; pexp_loc = a1 }, 767 - { pexp_desc = b0; pexp_loc = b1 }) 768 - -> (eq_expression_desc (a0, b0)) && (Location.eq_t (a1, b1)) 769 - 770 - let rec eq_directive_argument_desc : 771 - (directive_argument_desc * directive_argument_desc) -> 'result = 772 - function 773 - | (Pdir_none, Pdir_none) -> true 774 - | (Pdir_string a0, Pdir_string b0) -> eq_string (a0, b0) 775 - | (Pdir_int a0, Pdir_int b0) -> eq_int (a0, b0) 776 - | (Pdir_ident a0, Pdir_ident b0) -> Longident.eq_t (a0, b0) 777 - | (Pdir_bool a0, Pdir_bool b0) -> eq_bool (a0, b0) 778 - | (_, _) -> false 779 - and eq_directive_argument : 780 - (directive_argument * directive_argument) -> 'result = 781 - fun 782 - ({pdira_desc = a0; pdira_loc = a1}, 783 - {pdira_desc = b0; pdira_loc = b1}) 784 - -> (eq_directive_argument_desc (a0, b0)) && (Location.eq_t (a1, b1)) 785 - 786 - and eq_toplevel_phrase : 787 - (toplevel_phrase * toplevel_phrase) -> 'result = 788 - function 789 - | (Ptop_def a0, Ptop_def b0) -> eq_structure (a0, b0) 790 - | (Ptop_dir a0, Ptop_dir a1) -> 791 - Asttypes.eq_loc eq_string (a0.pdir_name, b0.pdir_name) && 792 - (eq_directive_argument (a1, b1)) 793 - | (_, _) -> false
-15
typing/typecore.ml
··· 170 170 ; expected_type : type_expr 171 171 ; explanation : type_forcing_context option 172 172 } 173 - | Scoping_let_module of string * type_expr 174 173 | Not_a_polymorphic_variant_type of Longident.t 175 174 | Incoherent_label_order 176 175 | Less_general of string * Errortrace.unification_error ··· 2280 2279 in 2281 2280 List.fold_left (fun env { mv_id; mv_loc; mv_name; mv_uid } -> 2282 2281 Typetexp.TyVarEnv.with_local_scope begin fun () -> 2283 - (* This code is parallel to the typing of Pexp_letmodule. However we 2284 - omit the call to [Mtype.lower_nongen] as it's not necessary here. 2285 - For Pexp_letmodule, the call to [type_module] is done in a raised 2286 - level and so needs to be modified to have the correct, outer level. 2287 - Here, on the other hand, we're calling [type_module] outside the 2288 - raised level, so there's no extra step to take. 2289 - *) 2290 2282 let modl, md_shape = 2291 2283 !type_module env 2292 2284 Ast_helper.( ··· 7312 7304 (label ~long:true) got 7313 7305 (if second_long then "being " else "") 7314 7306 (label ~long:second_long) expected 7315 - | Scoping_let_module(id, ty) -> 7316 - Location.errorf ~loc 7317 - "This %a expression has type@ %a@ \ 7318 - In this type, the locally bound module name %a escapes its scope" 7319 - Style.inline_code "let module" 7320 - (Style.as_inline_code Printtyp.type_expr) ty 7321 - Style.inline_code id 7322 7307 | Private_type ty -> 7323 7308 Location.errorf ~loc "Cannot create values of the private type %a" 7324 7309 (Style.as_inline_code Printtyp.type_expr) ty
-1
typing/typecore.mli
··· 209 209 ; expected_type : type_expr 210 210 ; explanation : type_forcing_context option 211 211 } 212 - | Scoping_let_module of string * type_expr 213 212 | Not_a_polymorphic_variant_type of Longident.t 214 213 | Incoherent_label_order 215 214 | Less_general of string * Errortrace.unification_error
-1
typing/typemod.ml
··· 3072 3072 | Lapply _ -> assert false 3073 3073 3074 3074 let type_package env m pack = 3075 - (* Same as Pexp_letmodule *) 3076 3075 let modl, scope = 3077 3076 Typetexp.TyVarEnv.with_local_scope begin fun () -> 3078 3077 (* type the module and create a scope in a raised level *)