Hi Tim, The `x.[i] <- v` syntax maps to `String.set` function, that has type `string -> char -> unit`, the array subscription syntax uses parentheses instead of the brackets. So in your case, it should be x.array_field.(1) <- 3 If you are concerned with the warning, that is emitted before the error. Then this is expected, as `x.[i] <- v` is a syntactic sugar to the `String.set` and it is translated on the lexing level. Thus the type checker never sees the array/string/bigarray subscript operators (as they are not present in the AST) Regards, Ivan On Tue, May 16, 2017 at 12:58 PM, Tim Leonard wrote: > Is type inference working as expected here, or is this a bug? > > # type record_type = { array_field : int array };; > type record_type = { array_field : int array; } > # let test_function_1 x = Array.set x.array_field 1 3;; > val test_function_1 : record_type -> unit = > # let test_function_2 x = x.array_field.[1] <- 3;; > Characters 24-46: > let test_function_2 x = x.array_field.[1] <- 3;; > ^^^^^^^^^^^^^^^^^^^^^^ > Warning 3: deprecated: String.set > Use Bytes.set instead. > Characters 24-37: > let test_function_2 x = x.array_field.[1] <- 3;; > ^^^^^^^^^^^^^ > Error: This expression has type int array > but an expression was expected of type bytes = string > # >