Skip to content

Strange type variable names in error messages (GADTs) #5780

@vicuna

Description

@vicuna

Original bug ID: 5780
Assigned to: @garrigue
Status: closed (set by @xavierleroy on 2017-02-16T14:18:35Z)
Resolution: fixed
Priority: normal
Severity: text
Version: 4.00.1
Target version: later
Fixed in version: 4.03.0+dev / +beta1
Category: typing
Related to: #7074
Child of: #5998
Monitored by: @lpw25 @yallop @hcarty

Bug description

Ocaml sometimes uses strange type variable names in error messages when type-checking GADTs (maybe to avoid name capture?).

Steps to reproduce

Enter the following code:

type _ t =
| B: bool -> bool t
| I: int -> int t
| A: ('a -> 'b) t * 'a t -> 'b t
| F: ('a -> 'b) -> ('a -> 'b) t

let rec eval: type s. s t -> s = function
| B b -> b
| I i -> i
| A (e, e') -> (eval e) e'
| F f -> f
;;

Ocaml reports the following error:

      Characters 94-96:
| A (e, e') -> (eval e) e'
                        ^^

Error: This expression has type ex#0 t but an expression was expected of type
ex#0

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions