Skip to content

Fix signature-help with type aliases#2067

Open
lyrm wants to merge 3 commits into
ocaml:mainfrom
lyrm:issue_1927
Open

Fix signature-help with type aliases#2067
lyrm wants to merge 3 commits into
ocaml:mainfrom
lyrm:issue_1927

Conversation

@lyrm
Copy link
Copy Markdown

@lyrm lyrm commented May 11, 2026

Fixes issue #1927.

What changes

signature help now expands types once to decide whether a value is a function:

type t = int -> unit
let f : t = fun _ -> ()
let _ = f  (* before: nothing; after: f : int -> unit *)

Same when there is an alias exposed mid-call: if the call supplies more arguments than the visible arrows allow, the alias is expanded.

type t = int -> unit
let f (_ : int) : t =let _ = f 1 2  (* f : int -> int -> unit *)

What have not changed

type t = int * int
let f (_ : t) = ()         
let _ = f  (* f : t -> unit, not f : int * int -> unit *)
type t = int -> unit
let f (_ : int) : t = unit 
let _ = f  (* f : int -> t` *)

What is still broken? (or is it on purpose?)

let f ~x = x + 1     
let _ = f  (* nothing *)

Even so

let f ~x = x + 1     
let _ = f  ~  (* f: x:int -> int *)

and

type t = x:int -> int
let f : t = fun ~x -> x + 1     
let _ = f  ~  (* f: x:int -> int *)

both work.

Copy link
Copy Markdown
Collaborator

@xvw xvw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The implementation seems reasonnable (and the test suite convincing). Thanks a lot.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants