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

Unsoundness when -rectypes fails to detect non-contractive type #6870

Closed
vicuna opened this issue May 14, 2015 · 4 comments
Closed

Unsoundness when -rectypes fails to detect non-contractive type #6870

vicuna opened this issue May 14, 2015 · 4 comments
Assignees

Comments

@vicuna
Copy link

vicuna commented May 14, 2015

Original bug ID: 6870
Reporter: @stedolan
Assigned to: @garrigue
Status: closed (set by @xavierleroy on 2016-12-07T10:49:21Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 4.02.1
Fixed in version: 4.02.2+dev / +rc1
Category: typing
Child of: #5343
Monitored by: @gasche @yallop

Bug description

OCaml 4.02.1 correctly rejects this dubious definition of a possibly non-contractive recursive type:

module type T = sig type 'a t end
module Fix (T : T) = struct type r = r T.t end

However, it accepts the following equivalent definition:

module Fix (T : T) = struct type r = ('r T.t) as 'r end

I think this is substantially the same issue as #5343. For a concrete example of how this leads to a segfault, see:

https://gist.github.com/stedolan/b5fe862fd350110ffa8e
@vicuna
Copy link
Author

vicuna commented May 17, 2015

Comment author: @garrigue

Indeed, one must fix the occur check too...

Fixed in trunk and 4.02 at revisions 16122 and 16123.

@vicuna
Copy link
Author

vicuna commented May 17, 2015

Comment author: @gasche

It seems that you didn't commit the .reference file; at least the test pr6870_bad fails in the testsuite.

@vicuna
Copy link
Author

vicuna commented May 17, 2015

Comment author: @garrigue

This is an ok/bad test. There is no need for a reference file.
On my machine, the test succeeds (i.e. compilation causes an error).

@vicuna
Copy link
Author

vicuna commented May 18, 2015

Comment author: @garrigue

Had just committed in the testsuite directory...
Really fixed at revision 16126.

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

No branches or pull requests

2 participants