-
Notifications
You must be signed in to change notification settings - Fork 11
Description
I was trying to come up with an example where erasing casts could lead to value representation issues, and accidentally found what seems to be a bug:
(let ([vec : (GVect Dyn) (gvector 1 #f)])
(begin (print-int 7)
(gvector-set! vec 0 42)
(print-int 9)))When compiling with --type-based-casts, this code compiles successfully, and prints 7, but never prints 9, and doesn't print any errors. On the other hand, when compiling with --coercions, this prints "7Implicit cast in binding on expression at example.grift:1:25" (which is the cast from (GVect Bool) to (GVect Dyn)).
First, this is clearly inconsistent behavior. Second, I am not sure why when using the coercion representation of casts, this even gives a cast error. Since the vector is parameterized by Dyn, shouldn't we be able to assign anything to it?
I saw other issues where type-based casts exhibit inconsistent behavior. I would be interested in fixing these inconsistencies, although I would like some guidance on what parts of code I should look at. This clearly happens after reduce-to-cast-calculus step, but I'm unsure where to look next.