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

first-class polymorphism type-checking failure (crash) #3477

Closed
vicuna opened this issue Jul 30, 2002 · 2 comments
Closed

first-class polymorphism type-checking failure (crash) #3477

vicuna opened this issue Jul 30, 2002 · 2 comments
Labels

Comments

@vicuna
Copy link

vicuna commented Jul 30, 2002

Original bug ID: 1274
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)

Bug description

Full_Name: John Prevost
Version: 3.05
OS: Windows
Submission from: 208.167.88.80 (208.167.88.80)

I've discovered a fairly serious typechecking bug in 3.05. I'm
also mentioning it on the mailing list so that people are aware.

You can do the following:

type bad = { x : 'a . 'a option ref };;

type bad = { x : 'a. 'a option ref; }

let bv = { x = ref None };;

val bv : bad = {x = {contents = None}}

bv.x := Some 5;;

  • : unit = ()

let extra_bad = !(bv.x);;

val extra_bad : '_a option = Some

f extra_bad;;

CRASH

It looks like mutable fields are handled correctly and catch that the
value is not, in fact, general enough. But when the mutable field is
part of the value (in this case, part of the ref), the check is not
done.

@vicuna
Copy link
Author

vicuna commented Aug 2, 2002

Comment author: administrator

Thanks for your report.
This was really a stupid bug: as others in the group already assessed, I just
forgot to check for non-expansiveness when generalizing first-class polymorphic
expressions.
The problem was specific to records: methods are always non-expansive.
This is now fixed (2 lines of code).

Jacques Garrigue

@vicuna
Copy link
Author

vicuna commented Aug 2, 2002

Comment author: administrator

Fixed by Jacques (2002-08-02)

@vicuna vicuna closed this as completed Aug 2, 2002
@vicuna vicuna added the bug label Mar 19, 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