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__ aborts the compiler/toplevel if the module name cannot be inferred #6547

Closed
vicuna opened this issue Sep 9, 2014 · 7 comments

Comments

Projects
None yet
2 participants
@vicuna
Copy link

commented Sep 9, 2014

Original bug ID: 6547
Reporter: kaustuv
Assigned to: @garrigue
Status: closed (set by @xavierleroy on 2016-12-07T10:34:43Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 4.02.0+beta1 / +rc1
Target version: 4.02.2+dev / +rc1
Fixed in version: 4.02.1+dev
Category: ~DO NOT USE (was: OCaml general)
Monitored by: @gasche @hcarty

Bug description

% ocaml
OCaml version 4.02.0

MODULE ;;

Fatal error: exception Invalid_argument("Filename.chop_extension")

% cat blah
let x = MODULE ;;

% ocamlc -impl blah
Fatal error: exception Invalid_argument("Filename.chop_extension")

%

File attachments

@vicuna

This comment has been minimized.

Copy link
Author

commented Sep 11, 2014

Comment author: @mshinwell

Jacques, would you be able to take a look at this? I presume it's related to the changes in 4.02 as a result of adding "-open".

@vicuna

This comment has been minimized.

Copy link
Author

commented Sep 11, 2014

Comment author: kaustuv

It has nothing to do with -open. See my patch above with a potential fix.

@vicuna

This comment has been minimized.

Copy link
Author

commented Sep 11, 2014

Comment author: @mshinwell

I thought there had been some discussion about changing how filenames were chopped during the -open discussion, though I may be misremembering.

@vicuna

This comment has been minimized.

Copy link
Author

commented Sep 12, 2014

Comment author: @mshinwell

Sorry, it wasn't the "-open" discussion, but rather the "-o" discussion that was part of that first discussion.

@vicuna

This comment has been minimized.

Copy link
Author

commented Sep 12, 2014

Comment author: @garrigue

It does not seem to be related to -o either: it just seems that the code for MODULE was weak from the beginning. Was it introduced by Fabrice?

Note that -o uses chop_extension_with_any, so it works with names that do not have an extension too.

@vicuna

This comment has been minimized.

Copy link
Author

commented Sep 14, 2014

Comment author: @damiendoligez

Why use "//unknown//" rather than the same "//toplevel//" that is used for Match_failure and Failed_assert ?

@vicuna

This comment has been minimized.

Copy link
Author

commented Sep 15, 2014

Comment author: @garrigue

Fixed in 4.02, at revision 15227.
Return "//" ^ Filename.basename file ^ "//" in case of failure,
which gives "//toplevel//" for the toplevel.

@vicuna vicuna closed this Dec 7, 2016

@vicuna vicuna added this to the 4.02.2 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.