ionide-vscode-fsharp
ionide-vscode-fsharp copied to clipboard
Type inference tooltip gives incorrect result in the editor
Problem
I've found an issue with the type inference tooltip
Steps to reproduce
If I type the function in my editor:let compose (f: 'a -> int) g = f >> g, I get the type signature
('a -> int) -> (int -> 'a) -> 'a -> 'a0, which is wrong (the type of g should be (int -> 'a0))
Machine infos
- Operating system: Windows_NT
- Arch: x64
- VSCode: 1.24.0
- MSBuild version:
Microsoft (R) Build Engine version 15.7.179.6572 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
fsharpi output is as follows:
~ fsharpi 8644 10:58:06
Microsoft (R) F# Interactive version 4.1
Copyright (c) Microsoft Corporation. All Rights Reserved.
For help type #help;;
> let compose (f: 'a -> int) g = f >> g;;
val compose : f:('a -> int) -> g:(int -> 'a0) -> ('a -> 'a0)
So this is a problem with the compiler and should be raised upstream at https://github.com/Microsoft/visualfsharp
Maybe I was trigger happy, my eyes have difficulty doing the comparison...
Its probably some artefact of global numbering starting from a0 and works through sequentially, whereas you don't really present global numbering to the user so you re-label them to start with a through z.
I would of thought the compiler would of reported the signature to be:
val compose : f:('a -> int) -> g:(int -> 'b) -> ('a -> 'b)
I think its the fact you introduces 'a into scope that the compiler starts with an 'a0
> let compose (f: _ -> int) (g: int -> _) = f >> g;;
val compose : f:('a -> int) -> g:(int -> 'b) -> ('a -> 'b)