Project

General

Profile

Revision b616fe7a src/types.ml

View differences:

src/types.ml
56 56
  | Not_a_dimension
57 57
  | Not_a_constant
58 58
  | WrongArity of int * int
59
  | WrongMorphism of int * int
59 60
  | Type_clash of type_expr * type_expr
60 61
  | Poly_imported_node of ident
61 62

  
......
158 159
    fprintf fmt "This expression is not a valid dimension@."
159 160
  | WrongArity (ar1, ar2) ->
160 161
    fprintf fmt "Expecting %d argument(s), found %d@." ar1 ar2
162
  | WrongMorphism (ar1, ar2) ->
163
    fprintf fmt "Expecting %d argument(s) for homomorphic extension, found %d@." ar1 ar2
161 164
  | Undefined_var vmap ->
162 165
    fprintf fmt "No definition provided for variable(s): %a@."
163 166
      (Utils.fprintf_list ~sep:"," pp_print_string)
......
211 214
 | Tstatic (_, ty') -> is_dimension_type ty'
212 215
 | _                -> false
213 216

  
214
let rec dynamic_type ty =
217
let dynamic_type ty =
215 218
  let ty = repr ty in
216 219
  match ty.tdesc with
217 220
  | Tstatic (_, ty') -> ty'
218 221
  | _                -> ty
219 222

  
223
let is_tuple_type ty =
224
 match (repr ty).tdesc with
225
 | Ttuple _         -> true
226
 | _                -> false
227

  
228
let rec is_nested_tuple_type ty =
229
 match (repr ty).tdesc with
230
 | Ttuple tl        -> List.exists is_tuple_type tl
231
 | _                -> false
232

  
220 233
let map_tuple_type f ty =
221 234
  let ty = dynamic_type ty in
222 235
  match ty.tdesc with
223 236
  | (Ttuple ty_list) -> { ty with tdesc = Ttuple (List.map f ty_list) }
224 237
  | _                -> f ty
225 238

  
226
let rec is_struct_type ty =
239
let is_struct_type ty =
227 240
 match (repr ty).tdesc with
228 241
 | Tstruct _        -> true
229 242
 | _                -> false

Also available in: Unified diff