type inst =
| InstRR of opcode * reg * reg
| InstRI of opcode * reg * imm;;
the error i get is : This expression has type inst/47646
list
but an expression was expected of type inst/48106
list
Type inst/47646
is not compatible with type inst/48106
but the list i'm sending is of type inst it's a list of InstRI
and InstRR
what could be the problem?
答案 0 :(得分:2)
The following minimal example shows how to reproduce the problem you're having:
# type t = A;; type t = A # let x = A;; val x : t = A # type t = A;; type t = A # let y = A;; val y : t = A # x = y;; Error: This expression has type t/1029 but an expression was expected of type t/1026
The number you see appended to the type name is used by the toplevel to disambiguate between distinct types having the same name. When you define a type in the toplevel, it hides any previously defined type with the same name, even if the type definition remains identical. To work around this, you only need to reevaluate all your statements.