Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix migration between 4.14 and 5.0 #124

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

laaksonel
Copy link

When compiling the following code with OCaml 5 and ocaml-migrate-parsetree 2.4.0

open Migrate_parsetree

let copy_structure str =
  str
  |> Migrate_406_407.copy_structure
  |> Migrate_407_408.copy_structure
  |> Migrate_408_409.copy_structure
  |> Migrate_409_410.copy_structure
  |> Migrate_410_411.copy_structure
  |> Migrate_411_412.copy_structure
  |> Migrate_412_413.copy_structure
  |> Migrate_413_414.copy_structure
  |> Migrate_414_500.copy_structure

let convert (str : Ast_406.Parsetree.structure) : Parsetree.structure =
  copy_structure str

The compilation fails

File "src/main.ml", line 16, characters 2-20:
16 |   copy_structure str
       ^^^^^^^^^^^^^^^^^^
Error: This expression has type
         Migrate_parsetree__.Ast_500.Parsetree.structure =
           Ast_500.Parsetree.structure_item list
       but an expression was expected of type
         Parsetree.structure = Compiler_libs.Parsetree.structure_item list
       Type Ast_500.Parsetree.structure_item is not compatible with type
         Compiler_libs.Parsetree.structure_item

It seems bare identity functions are not enough, so I generated the full-blown migration files.
With these files, the compilation passes.

Bare identity functions will end up in a mismatch between
installed OCaml 5.0 and Ast_500 module types.

With these full migrations, compilation passes again.

Expand OCaml 5 AST

Fix Option compilation errors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant