Skip to content

Unhelpful error with uncurried functions of different types but same parameter count #5165

@popstarfreas

Description

@popstarfreas

Rescript version: 9.1.3

When using uncurried functions, the compiler error is not helpful in pointing out the problem when two uncurried functions have different parameter types but the same number of parameters.

type callbackFn = (. int) => unit          
let a = (fn: callbackFn) => fn(. 1)        
                                           
type otherCallbackFn = (. float) => unit   
let otherFn: otherCallbackFn = (. _a) => ()
a(otherFn)                                 

Compiler gives:

4 _ type otherCallbackFn = (. float) => unit   
5 _ let otherFn: otherCallbackFn = (. _a) => ()
6 _ a(otherFn)                                 
7 _                                            
                                               
This function expected 1 argument, but got 1   

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions