coalton-lang / coalton

Coalton is an efficient, statically typed functional programming language that supercharges Common Lisp.
https://coalton-lang.github.io/
MIT License
1.12k stars 67 forks source link

Type error on over-application of anonymous functions #1208

Closed amorphedstar closed 1 month ago

amorphedstar commented 1 month ago

The typechecker will throw type errors like

The assertion
(COMMON-LISP:>= COALTON-IMPL/TYPECHECKER/TYPES::NUM
                #1=(COMMON-LISP:LENGTH
                    (COALTON-IMPL/TYPECHECKER/TYPES:FUNCTION-TYPE-ARGUMENTS
                     COALTON-IMPL/TYPECHECKER/TYPES:TY)))
failed with COALTON-IMPL/TYPECHECKER/TYPES::NUM = 1, #1# = 2.
   [Condition of type COMMON-LISP:SIMPLE-ERROR]

on code like

COALTON-USER> (coalton (let ((f (fn (x) (fn (y) (* x y))))) ((f 1) 2)))

or

COALTON-USER> (coalton-toplevel (define f (fn (x) (fn (y) (* x y)))))