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

ocaml does not understand array.tst.ml #7058

Closed
vicuna opened this issue Nov 25, 2015 · 2 comments
Closed

ocaml does not understand array.tst.ml #7058

vicuna opened this issue Nov 25, 2015 · 2 comments
Labels

Comments

@vicuna
Copy link

vicuna commented Nov 25, 2015

Original bug ID: 7058
Reporter: @bobzhang
Status: closed (set by @xavierleroy on 2017-02-16T14:16:33Z)
Resolution: not a bug
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)

Bug description

put this in array.tst.ml

module U= Array

it will complain unbound module Array

FYI, I am doing test for my ocaml to javascript compiler following javascript convention, I understand that filename is used as module name in OCaml, so it is not that easy to fix

@vicuna
Copy link
Author

vicuna commented Nov 25, 2015

Comment author: pcouderc

I don't understand what the problem is here actually. Whatever the extension is, the type checker should not behave differently (as long as it can recognize it).
Having such "pre"-extension might be useful for your build system (for calling automatically a preprocessor for example), but not to change the typing of the program.

However, the error message may be a bit confusing, since the problem is that the module Array is referencing itself (because indeed, filenames are module names).

@vicuna
Copy link
Author

vicuna commented Nov 27, 2015

Comment author: @xavierleroy

As @pcouderc mentions, array.tst.ml defines a compilation unit named Array, and a unit cannot refer to itself by name. The error message is not that good, though. Changing the conventional mapping from filename to compilation unit name would cause as much trouble as it solves here, since "Array.tst" is not a valid name for a compilation unit either.

Your best bet is to adopt a different naming convention, e.g. "array_tst.ml".

@vicuna vicuna closed this as completed Feb 16, 2017
@vicuna vicuna added the bug label Mar 20, 2019
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

1 participant