-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Strange behavior for function with polymorphic type #7483
Description
Original bug ID: 7483
Reporter: ChriChri
Assigned to: @lpw25
Status: resolved (set by @lpw25 on 2017-04-03T14:35:39Z)
Resolution: duplicate
Priority: normal
Severity: feature
Version: 4.04.0
Target version: 4.06.0 +dev/beta1/beta2/rc1
Category: typing
Duplicate of: #6673
Bug description
Annotating function with type 'a. ... and using 'a in the type of
auxilliary recursive function yield obscure error message.
Tested on 3.12 and 4.04
Steps to reproduce
compile the following:
let insert : 'a.('a -> 'a -> bool) -> 'a -> 'a list -> 'a list = fun cmp a l ->
let rec aux : 'a list -> 'a list = function
| [] -> [a]
| b::l -> if cmp a b then a::b::l else b::aux l
in aux l
yield
Error: This definition has type
('a -> 'a -> bool) -> 'a -> 'a list -> 'a list
which is less general than
'a0. ('a0 -> 'a0 -> bool) -> 'a0 -> 'a0 list -> 'a0 list