Open cianoc opened 6 years ago
I agree that we need a better error message here, but the error itself is not incorrect/inconsistent.
I think what you meant was
(bind-val f [i64,i64]* (myclosure 4))
Which functions correctly.
Maybe change this issue to reflect the compilers poor error reporting of this condition.
From: cianoc Sent: Saturday, 6 January 2018 2:51 PM To: digego/extempore Cc: Subscribed Subject: [digego/extempore] Compiler error when defining an anonymous closure(#310)
When running the following code: (bind-func my-closure (lambda (x:i64) (lambda (y) (+ x y))))
(bind-val f [i64,i64]* (myclosure 4))
($ (f 5)) ;; this triggers the error I get the following message from the compiler: Compiler Error compiler failed DECL @f = external global { i8, i8, i64 (i8, i8, i64)* } declare %mzone @llvm_pop_zone_stack () declare void @llvm_zone_destroy (%mzone) declare i8 @malloc (i64) declare i8 @memset (i8, i32, i64) declare i8 @strcpy (i8, i8) declare %String @toString_poly_W1N0cmluZyosaTY0Kl0q (i64) declare %String @zcopy_adhoc_W1N0cmluZyosU3RyaW5nKixtem9uZSosbXpvbmUqXQ (%String, %mzone, %mzone) declare i8 @zcopy_poly_W2k4KixpOCosbXpvbmUqLG16b25lKl0q (i8, %mzone, %mzone) ** ENDDECL ****
LLVM IR:
I think the error message should say something like f was expected a type of X, but instead got a type of Y.
When running the following code:
I get the following message from the compiler: