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

module alias breaks backward compatibility wrt separate compilation #6661

Closed
vicuna opened this issue Nov 18, 2014 · 2 comments
Closed

module alias breaks backward compatibility wrt separate compilation #6661

vicuna opened this issue Nov 18, 2014 · 2 comments
Assignees
Labels

Comments

@vicuna
Copy link

vicuna commented Nov 18, 2014

Original bug ID: 6661
Reporter: @ygrek
Assigned to: @garrigue
Status: closed (set by @xavierleroy on 2016-12-07T10:36:55Z)
Resolution: not fixable
Priority: normal
Severity: major
Version: 4.02.1
Fixed in version: 4.03.0+dev / +beta1
Category: ~DO NOT USE (was: OCaml general)
Monitored by: @hcarty

Bug description

$ cat a.ml
module X = Xmlm
type x = X.encoding

$ cat b.ml
type q = A.X.encoding

$ opam config exec --switch 4.01.0 -- bash -c 'ocamlc -I $(ocamlfind query xmlm) -c a.ml && ocamlc -c b.ml'

$ opam config exec --switch 4.02.1 -- bash -c 'ocamlc -I $(ocamlfind query xmlm) -c a.ml && ocamlc -c b.ml'
File "b.ml", line 1, characters 9-21:
Error: Unbound type constructor A.X.encoding

Steps to reproduce

IIUC previous versions of compiler expanded the module alias and so the other module had all the information of module structure contents, but nowadays it sees only the module alias and cannot dig into it without cmi.

@vicuna
Copy link
Author

vicuna commented Nov 18, 2014

Comment author: @garrigue

The whole point of module alias being avoiding to duplicated information in the cmi's, this cannot be avoided: the signature of Xmlm is no longer included in a.cmi.
A workaround is to write an explicit mli.
(Changes didn't document this incompatibility; fixed in 15597)

@vicuna
Copy link
Author

vicuna commented Nov 18, 2014

Comment author: @ygrek

Another obvious fix is just provide the include path for compiler invocation for all modules using the alias.

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

No branches or pull requests

2 participants