Skip to content

Unsoundness with GADTs and let rec #7215

@vicuna

Description

@vicuna

Original bug ID: 7215
Reporter: @stedolan
Assigned to: @yallop
Status: resolved (set by @yallop on 2017-09-25T14:14:16Z)
Resolution: fixed
Priority: normal
Severity: crash
Version: 4.03.0+dev / +beta1
Target version: 4.06.0 +dev/beta1/beta2/rc1
Category: typing
Related to: #6738 #7231
Monitored by: braibant @gasche @diml

Bug description

The following program segfaults, on at least 4.02.1, 4.03.0+beta1 and trunk:

type (,) eq = Refl : ('a, 'a) eq
let cast (type a) (type b) (Refl : (a, b) eq) (x : a) = (x : b)

let is_int (type a) =
let rec (p : (int, a) eq) = match p with Refl -> Refl in
p

let bang = print_string (cast (is_int : (int, string) eq) 42)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions