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

Fix soundness bug in extension constructor inclusion #8800

Merged
merged 3 commits into from Jul 11, 2019

Conversation

@lpw25
Copy link
Contributor

commented Jul 10, 2019

# type _ t = ..;;
type _ t = ..

# module M : sig
    type 'a t += Foo : 'b -> 'b t
    val x : string t
  end = struct
    type 'a t += Foo : 'b -> 'c t
    let x = Foo 0
  end;;
module M : sig type 'a t += Foo : 'b -> 'b t val x : string t end

# let M.Foo s = M.x;;
Characters 4-11:
  let M.Foo s = M.x;;
      ^^^^^^^
Warning 8: this pattern-matching is not exhaustive.
Here is an example of a case that is not matched:
*extension*
Matching over values of extensible variant types (the *extension* above)
must include a wild card pattern in order to be exhaustive.

Process OCaml segmentation fault (core dumped)

The inclusion check for extension constructors with GADT syntax was comparing the types of the arguments in combination with the types of the type parameters rather than the return types. The fix is simple and follows how the same issue is handled in ordinary constructors.

Copy link
Contributor

left a comment

This makes sense indeed.

@lpw25 lpw25 merged commit a495899 into ocaml:trunk Jul 11, 2019
2 checks passed
2 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@lpw25

This comment has been minimized.

Copy link
Contributor Author

commented Jul 11, 2019

Cherry-picked to 4.09 as 477cd18..57fda88

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.