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__ doesn't give the current module with -o #6857

Closed
vicuna opened this issue May 5, 2015 · 1 comment

Comments

Projects
None yet
2 participants
@vicuna
Copy link

commented May 5, 2015

Original bug ID: 6857
Reporter: @sliquister
Assigned to: @garrigue
Status: closed (set by @xavierleroy on 2016-12-07T10:49:11Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 4.02.1
Target version: 4.02.3+dev
Fixed in version: 4.02.2+dev / +rc1
Category: ~DO NOT USE (was: OCaml general)
Tags: junior_job
Monitored by: @gasche

Bug description

MODULE appears to be [String.capitalize (String.chop_suffix FILE)], which is not the current module when using -o to set a module name different than the current file name.

But its documentation is:
MODULE returns the module name of the file being parsed by the compiler.

So it looks like either the compiler or the documentation should be fixed (and preferably the compiler I think).

Steps to reproduce

These commands should output "Foo" twice but instead output "A" and "Argh".

cd /tmp
rm -f .cm
echo '
let () = Printf.printf "%S\n%!" MODULE
#1 "argh.p"
let () = Printf.printf "%S\n%!" MODULE
' > a.ml
ocamlopt -c -o foo a.ml
ocamlopt foo.cmx
./a.out

@vicuna

This comment has been minimized.

Copy link
Author

commented May 6, 2015

Comment author: @garrigue

Fixed in 4.02 at revision 16087.

@vicuna vicuna closed this Dec 7, 2016

@vicuna vicuna added the junior-job label Mar 14, 2019

@vicuna vicuna added this to the 4.02.3 milestone Mar 14, 2019

@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
You can’t perform that action at this time.