text stringlengths 12 786k |
|---|
module Type = struct open Type let opaque = Ident . create ~ mode : Checked " opaque " let mk_poly ~ loc ~ mode vars typ env = { Typedast . type_desc = Ttyp_poly ( vars , typ ) ; type_loc = loc ; type_type = Mk . poly ~ mode ( List . map ~ f : type0 vars ) ( type0 typ ) env ... |
module TypeDecl = struct open TypeDecl let generalise decl = let poly_name = map_loc decl . tdec_ident ~ f ( : fun name -> if name = " t " then " poly " else name ^ " _poly " ) in match decl . tdec_desc with | Pdec_record fields -> let field_vars = List . map fields ~ f ( : fun { ... |
let pp_decl_typ ppf decl = pp_typ ppf { type_desc = Ptyp_ctor { var_ident = mk_lid decl . tdec_ident ; var_params = decl . tdec_params } ; type_loc = Location . none } |
let report_error ppf = function | Unbound_type_var name -> let quot = match name with " _ " -> " " | _ -> " ' " in fprintf ppf " [ @< hov > Unbound type parameter @ % s % s . ] " @ quot name | Wrong_number_args ( path , given , expected ) -> fprintf ppf " [ @ The ty... |
let ( ) = Location . register_error_of_exn ( function | Error ( loc , err ) -> Some ( Location . error_of_printer ~ loc report_error err ) | _ -> None ) |
let empty_head variable = { Type . Callable . head = [ ] ; variable } |
let ( ! ) concretes = List . map concretes ~ f ( : fun single -> Type . Parameter . Single single ) |
let make_callable_from_arguments annotations = Type . Callable . Defined ( List . mapi ~ f ( : fun index annotation -> Type . Callable . RecordParameter . PositionalOnly { index ; annotation ; default = false } ) annotations ) |
let assert_create ( ? aliases = fun _ -> None ) source annotation = assert_equal ~ printer : Type . show ~ cmp : Type . equal annotation ( Type . create ~ aliases ( : fun ? replace_unbound_parameters_with_any : _ -> aliases ) ( parse_single_expression ~ preprocess : true source ) ) ... |
let test_create _ = assert_create " foo " ( Type . Primitive " foo " ) ; assert_create " foo . bar " ( Type . Primitive " foo . bar " ) ; assert_create " object " ( Type . Primitive " object " ) ; assert_create " foo [ bar ] " ( Type . parametric " foo... |
let test_create_callable _ = let default_overload = { Type . Callable . annotation = Type . Top ; parameters = Undefined } in let open Type . Callable in assert_create " typing . Callable " ( Type . Primitive " typing . Callable " ) ; assert_create " typing . Callable [ . ... |
let test_create_alias _ = let assert_alias source resolved = let aliases primitive = Identifier . Table . of_alist_exn [ " Alias " , Type . Primitive " Aliased " ; " IntList " , Type . list Type . integer ; ( " _Future " , Type . union [ Type . parametric " Future " ... |
let test_create_type_operator _ = let assert_create ( ? aliases = fun _ -> None ) source annotation = assert_equal ~ printer : Type . show ~ cmp : Type . equal annotation ( Type . create ~ aliases ( : fun ? replace_unbound_parameters_with_any : _ -> aliases ) ( parse_single_expression... |
let test_create_variadic_tuple _ = let assert_create ( ? aliases = fun _ -> None ) source annotation = assert_equal ~ printer : Type . show ~ cmp : Type . equal annotation ( Type . create ~ aliases ( : fun ? replace_unbound_parameters_with_any : _ -> aliases ) ( parse_single_expressio... |
let test_resolve_aliases _ = let assert_resolved ~ aliases annotation expected = let aliases ? replace_unbound_parameters_with_any : _ = aliases in assert_equal ~ printer : Type . show ~ cmp : Type . equal expected ( Type . resolve_aliases ~ aliases annotation ) in let aliases = function | " ... |
let test_instantiate _ = let assert_instantiate mappings ~ generic ~ expected = let map = Type . Map . of_alist_exn mappings in assert_equal ~ printer : Type . show ~ cmp : Type . equal expected ( Type . instantiate ~ constraints ( : Map . find map ) generic ) in assert_instantiate [ ]... |
let test_expression _ = let assert_expression annotation expression = assert_equal ~ printer : Expression . show ~ cmp ( : fun left right -> Expression . location_insensitive_compare left right = 0 ) ( parse_single_expression ~ coerce_special_methods : true expression ) ( Type . expression a... |
let test_concise _ = let assert_concise annotation expected = assert_equal ~ printer ( : fun annotation -> annotation ) expected ( Type . show_concise annotation ) in assert_concise Type . Bottom " " ; ? assert_concise Type . Top " unknown " ; assert_concise ( Type . Callable . cr... |
let test_weaken_literals _ = let assert_weakened_literal literal expected = assert_equal ~ printer : Type . show ~ cmp : Type . equal expected ( Type . weaken_literals literal ) in assert_weakened_literal ( Type . literal_integer 1 ) Type . integer ; assert_weakened_literal ( Type . lite... |
let test_union _ = let assert_union arguments expected = assert_equal ~ printer : Type . show ~ cmp : Type . equal expected ( Type . union arguments ) in assert_union [ Type . string ; Type . optional ( Type . Union [ Type . integer ; Type . string ] ) ] ( Type . Union [ ... |
let test_primitives _ = assert_equal [ ] ( Type . primitives ( Type . Callable . create ~ annotation : Type . Top ( ) ) ) ; assert_equal [ Type . integer ] ( Type . primitives ( Type . Callable . create ~ annotation : Type . integer ( ) ) ) ; assert_equal [ ... |
let test_elements _ = let assert_equal = assert_equal ~ printer ( : List . to_string ~ f : Fn . id ) in assert_equal [ " typing . Callable " ] ( Type . elements ( Type . Callable . create ~ annotation : Type . Top ( ) ) ) ; assert_equal [ " int " ; " typing . ... |
let test_exists _ = let top_exists = Type . exists ~ predicate ( : function | Type . Top -> true | _ -> false ) in assert_true ( top_exists ( Type . Callable . create ~ annotation : Type . Top ( ) ) ) ; assert_false ( top_exists ( Type . Callable . create ~ annotation :... |
let test_is_iterator _ = assert_true ( Type . is_iterator ( Type . iterator Type . string ) ) ; assert_false ( Type . is_iterator Type . string ) ; assert_false ( Type . is_iterator ( Type . Primitive " typing . Iterator " ) ) |
let test_contains_callable _ = assert_true ( Type . contains_callable ( Type . Callable . create ~ annotation : Type . integer ( ) ) ) ; assert_true ( Type . contains_callable ( Type . optional ( Type . Callable . create ~ annotation : Type . integer ( ) ) ) ) ; a... |
let test_map_callable_annotation _ = let assert_mapped ~ f callable expected = assert_equal ~ cmp : Type . Callable . equal ~ printer : Type . Callable . show expected ( Type . Callable . map_annotation ~ f callable ) in let callable = { Type . Record . Callable . kind = Type . Reco... |
let test_type_parameters_for_bounded_tuple_union _ = let assert_type_parameters actual expected = assert_equal ~ cmp [ :% equal : Type . t list option ] ~ printer [ :% show : Type . t list option ] expected ( Type . type_parameters_for_bounded_tuple_union actual ) in assert_type_parameters Ty... |
let test_contains_any _ = assert_true ( Type . contains_any Type . Any ) |
let test_expression_contains_any _ = assert_true ( Type . expression_contains_any ( parse_single_expression ~ preprocess : true " typing . Dict [ typing . Any , typing . Any ] " ) ) ; assert_false ( Type . expression_contains_any ( parse_single_expression ~ preprocess : true " ... |
let test_is_concrete _ = assert_true ( Type . is_concrete Type . none ) ; assert_true ( Type . is_concrete ( Type . parametric " typing . Optional " [ ! Type . Bottom ] ) ) ; assert_true ( Type . is_concrete ( Type . Callable . create ~ annotation : Type . none ( )... |
let test_is_not_instantiated _ = assert_true ( Type . is_not_instantiated Type . Bottom ) ; assert_true ( Type . is_not_instantiated ( Type . dictionary ~ key : Type . Bottom ~ value : Type . Bottom ) ) ; assert_false ( Type . is_not_instantiated Type . NoneType ) ; assert_fa... |
let test_is_meta _ = assert_true ( Type . is_meta ( Type . parametric " type " [ ! Type . integer ] ) ) ; assert_false ( Type . is_meta Type . integer ) ; assert_false ( Type . is_meta ( Type . parametric " typing . Type " [ ! Type . integer ] ) ) |
let test_is_none _ = assert_false ( Type . is_none ( Type . Primitive " None " ) ) ; assert_false ( Type . is_none Type . integer ) ; assert_false ( Type . is_none ( Type . Primitive " foo " ) ) ; assert_true ( Type . is_none Type . NoneType ) |
let test_is_type_alias _ = assert_true ( Type . is_type_alias ( Type . Primitive " typing_extensions . TypeAlias " ) ) ; assert_false ( Type . is_type_alias ( Type . Primitive " typing . TypeAlias " ) ) ; assert_false ( Type . is_type_alias ( Type . parametric " typin... |
let test_create_recursive_type _ = let tree_name , tree_body = " Tree " , Type . union [ Type . integer ; Type . tuple [ Type . Primitive " Foo " ; Type . Primitive " Tree " ] ] in let tree_annotation = Type . RecursiveType . create ~ name : tree_name ~ body : tree_body... |
let test_unfold_recursive_type _ = let assert_unfolded recursive_type expected = assert_equal ~ cmp : Type . equal ~ printer : Type . show expected ( match recursive_type with | Type . RecursiveType record -> Type . RecursiveType . unfold_recursive_type record | _ -> failwith " expected Recurs... |
let test_contains_unknown _ = assert_true ( Type . contains_unknown Type . Top ) ; assert_false ( Type . contains_unknown Type . Bottom ) ; assert_false ( Type . contains_unknown Type . Any ) ; assert_true ( Type . contains_unknown ( Type . optional Type . Top ) ) ; asser... |
let test_contains_undefined _ = assert_true ( Type . contains_undefined Type . Bottom ) ; assert_false ( Type . contains_undefined Type . Top ) ; assert_false ( Type . contains_undefined Type . Any ) ; assert_true ( Type . contains_undefined ( Type . optional Type . Bottom ) ... |
let test_is_resolved _ = assert_false ( Type . Variable . all_variables_are_resolved ( Type . variable " _T " ) ) ; assert_false ( Type . Variable . all_variables_are_resolved ( Type . union [ Type . integer ; Type . variable " _T " ] ) ) ; assert_true ( Type . ... |
let test_class_name _ = let assert_class_name annotation expected = assert_equal ~ cmp : Reference . equal ~ printer : Reference . show ( Reference . create expected ) ( Type . class_name annotation ) in assert_class_name ( Type . Primitive " qualified . primitive " ) " qualified . ... |
let test_optional_value _ = assert_equal ( Option . value_exn ( Type . optional_value ( Type . optional ( Type . parametric " foo " [ ! Type . integer ; Type . Top ] ) ) ) ) ( Type . parametric " foo " [ ! Type . integer ; Type . Top ] ) ; assert_true ( ... |
let test_dequalify _ = let map = { | from typing import ( Optional , List , ) import typing from A . B import C import d as e } | in let assert_dequalify source expected = assert_equal ~ cmp : Type . equal ~ printer ( : Format . asprintf " % a " Type . pp ) ~ pp_diff ( : diff ... |
let test_from_overloads _ = let assert_create ( ? aliases = Type . empty_aliases ) sources expected = let merged = let parse_callable source = match Type . create ~ aliases ( parse_single_expression source ) with | Type . Callable callable -> callable | _ -> failwith ( " Could not extract... |
let test_with_return_annotation _ = let assert_with_return_annotation annotation callable expected = let callable = match Type . create ~ aliases : Type . empty_aliases ( parse_single_expression callable ) with | Type . Callable callable -> callable | _ -> failwith ( " Could not extract callabl... |
let test_overload_parameters _ = let assert_parameters callable expected = let { Type . Callable . overloads ; _ } = Type . create ~ aliases : Type . empty_aliases ( parse_single_expression callable ) |> function | Type . Callable callable -> callable | _ -> failwith ( " Could not e... |
let test_variables _ = let assert_variables source expected = let aliases = let aliases = Identifier . Map . of_alist_exn [ " T " , Type . variable " T " ; " S " , Type . variable " S " ] in Map . find aliases in let aliases = create_type_alias_table aliases in let variables =... |
let test_lambda _ = assert_true ( Type . equal ( parse_callable " typing . Callable [ [ Named ( x , str ) ] , int ] " ) ( Type . lambda ~ parameters [ " : x " , Type . string ] ~ return_annotation : Type . integer ) ) ; assert_true ( Type . equal ( parse... |
let test_visit _ = let create source = Type . create ~ aliases : Type . empty_aliases ( parse_single_expression source ) in let assert_types_equal annotation expected = assert_equal ~ printer : Type . show ~ cmp : Type . equal expected annotation in let module CountTransform = Type . Transform ... |
let test_collapse_escaped_variable_unions _ = let assert_types_equal annotation expected = assert_equal ~ printer : Type . show ~ cmp : Type . equal expected annotation in let escaped = Type . Variable . mark_all_free_variables_as_escaped ( Type . variable " Escapee " ) in assert_types_equal (... |
let test_namespace_insensitive_compare _ = let no_namespace_variable = Type . Variable . Unary . create " A " in let namespaced_variable_1 = let namespace = Type . Variable . Namespace . create_fresh ( ) in Type . Variable { no_namespace_variable with namespace } in let namespaced_variabl... |
let test_namespace _ = let no_namespace_variable = Type . Variable . Unary . create " A " in let namespaced_variable_1 = let namespace = Type . Variable . Namespace . create_fresh ( ) in Type . Variable . Unary { no_namespace_variable with namespace } in let namespace_2 = Type . Vari... |
let test_mark_all_variables_as_bound _ = let variable = Type . Variable ( Type . Variable . Unary . create " T " ) in assert_false ( Type . Variable . all_variables_are_resolved variable ) ; let variable = Type . Variable . mark_all_variables_as_bound variable in assert_true ( Type .... |
let test_mark_all_variables_as_free _ = let variable = Type . Variable ( Type . Variable . Unary . create " T " ) |> Type . Variable . mark_all_variables_as_bound in assert_true ( Type . Variable . all_variables_are_resolved variable ) ; let variable = Type . Variable . mark_all_v... |
let test_namespace_all_free_variables _ = let free_variable = Type . Variable ( Type . Variable . Unary . create " T " ) in let bound_variable = Type . Variable . Unary . create " T2 " |> Type . Variable . Unary . mark_as_bound |> fun variable -> Type . Variable variable in let ... |
let test_mark_all_free_variables_as_escaped _ = let free_variable = Type . Variable ( Type . Variable . Unary . create " T " ) in let bound_variable = Type . Variable . Unary . create " T2 " |> Type . Variable . Unary . mark_as_bound |> fun variable -> Type . Variable variable i... |
let test_contains_escaped_free_variable _ = let free_variable = Type . Variable ( Type . Variable . Unary . create " T " ) in assert_false ( Type . Variable . contains_escaped_free_variable free_variable ) ; let escaped_free = Type . Variable . Unary . create " T " |> Type . V... |
let polynomial_create_from_variables_list = Type . Polynomial . create_from_variables_list ~ compare_t : Type . compare |
let test_convert_all_escaped_free_variables_to_anys _ = let free_variable = Type . Variable ( Type . Variable . Unary . create " T " ) in let escaped_free = Type . Variable . Unary . create " T " |> Type . Variable . Unary . mark_as_escaped |> fun variable -> Type . Variable var... |
let test_int_expression_create _ = let x = Type . Variable . Unary . create " x " in let y = Type . Variable . Unary . create " y " in let assert_create_list_type given expected = assert_equal ~ printer [ :% show : Type . type_t ] ~ cmp [ :% equal : Type . type_t ] ( Type . ... |
let test_replace_all _ = let free_variable = Type . Variable ( Type . Variable . Unary . create " T " ) in let annotation = Type . parametric " p " [ ! free_variable ; Type . integer ] in let assert_equal actual expected = assert_equal ~ cmp : Type . equal ~ printer : Type . ... |
let test_product_replace_variadic _ = let assert_equal actual expected = assert_equal ~ cmp : Type . equal ~ printer : Type . show expected actual in let variadic = Type . Variable . Variadic . Tuple . create " Ts " in let variadic2 = Type . Variable . Variadic . Tuple . create " Ts2 ... |
let test_less_or_equal _ = let assert_solve ~ left ~ right expected = let impossible = [ ] in let rec solve ~ left ~ right = match left , right with | Type . Variable variable1 , Type . Variable variable2 -> List . sort [ [ variable1 , Type . Variable variable2 ] ; [ variable2 , ... |
let test_collect_all _ = let free_variable = Type . Variable ( Type . Variable . Unary . create " T " ) in let annotation = Type . parametric " p " [ ! free_variable ; Type . integer ] in assert_equal ( Type . Variable . GlobalTransforms . Unary . collect_all annotation ) ... |
let test_parse_type_variable_declarations _ = let assert_parses_declaration expression expected = assert_equal ( Some expected ) ( Type . Variable . parse_declaration ( parse_single_expression expression ) ~ target ( : Reference . create " target " ) ) in let assert_declaration_does_not_p... |
let test_starred_annotation_expression _ = let assert_starred_expression concatenation expression = assert_equal ~ printer : Expression . show ~ cmp ( : fun left right -> Expression . location_insensitive_compare left right = 0 ) ( parse_single_expression ~ coerce_special_methods : true expression... |
let test_concatenation_from_unpack_expression _ = let variadic = Type . Variable . Variadic . Tuple . create " Ts " in let assert_concatenation expression concatenation = let parse_annotation expression = let aliases ? replace_unbound_parameters_with_any : _ = function | " Ts " -> Some ( Ty... |
let test_broadcast _ = let assert_broadcast left_type right_type expected = assert_equal ~ printer [ :% show : Type . t ] ~ cmp [ :% equal : Type . t ] ( Type . OrderedTypes . broadcast left_type right_type ) expected ; assert_equal ~ printer [ :% show : Type . t ] ~ cmp [ :%... |
let test_split_ordered_types _ = let variadic = Type . Variable . Variadic . Tuple . create " Ts " in let assert_split ( ? split_both_ways = true ) left right expected = let aliases ? replace_unbound_parameters_with_any : _ = function | " Ts " -> Some ( Type . VariableAlias ( Type ... |
let test_coalesce_ordered_types _ = let variadic = Type . Variable . Variadic . Tuple . create " Ts " in let assert_coalesce ordered_types expected = let aliases ? replace_unbound_parameters_with_any : _ = function | " Ts " -> Some ( Type . VariableAlias ( Type . Variable . TupleVari... |
let test_drop_prefix_ordered_type _ = let open Type . OrderedTypes in let assert_drop_prefix ~ length actual expected_tuple = let variadic = Type . Variable . Variadic . Tuple . create " Ts " in let aliases ? replace_unbound_parameters_with_any : _ = function | " Ts " -> Some ( Type . V... |
let test_index_ordered_type _ = let assert_index ~ python_index tuple expected = let variadic = Type . Variable . Variadic . Tuple . create " Ts " in let aliases ? replace_unbound_parameters_with_any : _ = function | " Ts " -> Some ( Type . VariableAlias ( Type . Variable . TupleVar... |
let test_zip_variables_with_parameters _ = let unary = Type . Variable . Unary . create " T " in let unary2 = Type . Variable . Unary . create " T2 " in let variadic = Type . Variable . Variadic . Tuple . create " Ts " in let variadic2 = Type . Variable . Variadic . Tuple . ... |
let test_zip_on_two_parameter_lists _ = let unary = Type . Variable . Unary . create " T " in let unary2 = Type . Variable . Unary . create " T2 " in let variadic = Type . Variable . Variadic . Tuple . create " Ts " in let variadic2 = Type . Variable . Variadic . Tuple . cr... |
let test_union_upper_bound _ = let assert_union_upper_bound map expected = assert_equal ~ printer : Type . show ~ cmp : Type . equal ( Type . OrderedTypes . union_upper_bound map ) expected in assert_union_upper_bound ( Concrete [ Type . integer ; Type . string ; Type . bool ] ) ( ... |
let test_infer_transform _ = let assert_transform ~ expected ~ annotation = assert_equal ( Type . infer_transform annotation ) expected in assert_transform ~ annotation ( : Type . parametric " _PathLike " [ ! Type . Primitive " string " ] ) ~ expected ( : Type . parametric " P... |
let test_fields_from_constructor _ = let assert_fields ~ constructor ~ expected = assert_equal ~ printer [ :% show : Type . t Type . Record . TypedDictionary . typed_dictionary_field list option ] expected ( Type . TypedDictionary . fields_from_constructor constructor ) in let fields = [ ... |
let test_is_unit_test _ = let assert_is_unit_test name expected = Type . Primitive . is_unit_test name |> assert_equal expected in assert_is_unit_test " unittest . TestCase " true ; assert_is_unit_test " unittest . case . TestCase " true ; assert_is_unit_test " a . TestCase " false ; (... |
let polynomial_show_normal = Type . Polynomial . show_normal ~ show_variable : Type . polynomial_show_variable ~ show_type : Type . pp |
let polynomial_add = Type . Polynomial . add ~ compare_t : Type . compare |
let polynomial_subtract = Type . Polynomial . subtract ~ compare_t : Type . compare |
let polynomial_multiply = Type . Polynomial . multiply ~ compare_t : Type . compare |
let polynomial_divide = Type . Polynomial . divide ~ compare_t : Type . compare |
let test_polynomial_create_from_list _ = let assert_create given expected = let given = polynomial_create_from_variables_list given in assert_equal ~ printer : Fn . id expected ( polynomial_show_normal given ) in let x = Type . Variable . Unary . create " x " in let y = Type . Variable . Una... |
let test_polynomial_to_type _ = let x = Type . Variable . Unary . create " x " in let y = Type . Variable . Unary . create " y " in let aliases ? replace_unbound_parameters_with_any : _ = function | " x " -> Some ( Type . TypeAlias ( Type . Variable x ) ) | " y " -> S... |
let test_polynomial_replace _ = let x = Type . Variable . Unary . create " x " in let y = Type . Variable . Unary . create " y " in let z = Type . Variable . Unary . create " z " in let w = Type . Variable . Unary . create " w " in let assert_polynomial_replace given ~ rep... |
let test_add_polynomials _ = let assert_add given1 given2 expected = let given1 = polynomial_create_from_variables_list given1 in let given2 = polynomial_create_from_variables_list given2 in assert_equal ~ printer : Fn . id expected ( polynomial_show_normal ( polynomial_add given1 given2 ) ) ; assert... |
let test_subtract_polynomials _ = let assert_subtract given1 given2 expected = let given1 = polynomial_create_from_variables_list given1 in let given2 = polynomial_create_from_variables_list given2 in assert_equal ~ printer : Fn . id expected ( polynomial_show_normal ( polynomial_subtract given1 given2 ) ... |
let test_multiply_polynomial _ = let assert_multiply given1 given2 expected = let given1 = polynomial_create_from_variables_list given1 in let given2 = polynomial_create_from_variables_list given2 in assert_equal ~ printer : Fn . id expected ( polynomial_show_normal ( polynomial_multiply given1 given2 ) ... |
let test_divide_polynomial _ = let assert_divide given1 given2 expected = let given1 = polynomial_create_from_variables_list given1 in let given2 = polynomial_create_from_variables_list given2 in assert_equal ~ printer : Fn . id expected ( polynomial_show_normal ( polynomial_divide given1 given2 ) ) in... |
let test_parameter_create _ = assert_equal ( Type . Callable . Parameter . create [ { Type . Callable . Parameter . name = " __ " ; annotation = Type . integer ; default = false } ] ) [ Type . Callable . Parameter . PositionalOnly { index = 0 ; annotation = Type . ... |
let test_resolve_getitem_callee _ = let open Expression in let assert_resolved_getitem_callee ( ? resolve_aliases = Fn . id ) actual expected = let parse_callee given = match parse_single_expression given |> Node . value with | Expression . Call { callee = { Node . value = callee ; _ } ; ... |
let test_resolve_class _ = let assert_resolved_class annotation expected = assert_equal ~ printer ( : fun x -> [ % sexp_of : Type . class_data list option ] x |> Sexp . to_string_hum ) expected ( Type . resolve_class annotation ) in assert_resolved_class Type . Any ( Some [ ] ) ; ... |
let test_show _ = let assert_show given ~ expected_full ~ expected_concise = assert_equal ~ cmp : String . equal ~ printer : Fn . id ( [ % show : Type . t ] given ) expected_full ; assert_equal ~ cmp : String . equal ~ printer : Fn . id ( Type . show_concise given ) expected_con... |
let ( ) = " type " >::: [ " create " >:: test_create ; " create_callable " >:: test_create_callable ; " create_alias " >:: test_create_alias ; " create_type_operator " >:: test_create_type_operator ; " create_variadic_tuple " >:: test_create_variadic_tuple ; " resolve_al... |
type error = Unbound_type_variable of string | Undefined_type_constructor of Path . t | Type_arity_mismatch of Longident . t * int * int | Bound_type_variable of string | Recursive_type | Unbound_row_variable of Longident . t | Type_mismatch of Ctype . Unification_trace . t | Alias_type_mismatch of ... |
type variable_context = int * type_expr TyVarMap . t |
let transl_modtype_longident = ref ( fun _ -> assert false ) |
let transl_modtype = ref ( fun _ -> assert false ) |
let create_package_mty fake loc env ( p , l ) = let l = List . sort ( fun ( s1 , _t1 ) ( s2 , _t2 ) -> if s1 . txt = s2 . txt then raise ( Error ( loc , env , Multiple_constraints_on_type s1 . txt ) ) ; compare s1 . txt s2 . txt ) l in l , List . fold_left ( f... |
let type_variables = ref ( TyVarMap . empty : type_expr TyVarMap . t ) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.