You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When adding a type annotation on an assignment, the annotation is only used for the Seahorse type checker.
-- This Seahorse code:
n = 1
m: u64 = 2
-- Turns into roughly this Rust code:
let mut n = 1;
let mut m = 2;
This leads to unintuitive bugs popping up when you try to use a type annotation to solve a compilation error:
-- This Seahorse code:
n = 10**2
-- Turns into this Rust code, which fails to compile because .pow() is not defined on arbitrary integers:
let mut n = 10.pow(2);
-- Intuitively, you might try to fix the code in one of these two ways, but both will fail because the
-- generated code doesn't care about the type annotation:
n1: u64 = 10**2
b: u64 = 10
n2 = b**2
To prevent this issue, type annotations in Seahorse should lead to type annotations in the generated Rust code.
The text was updated successfully, but these errors were encountered:
When adding a type annotation on an assignment, the annotation is only used for the Seahorse type checker.
This leads to unintuitive bugs popping up when you try to use a type annotation to solve a compilation error:
To prevent this issue, type annotations in Seahorse should lead to type annotations in the generated Rust code.
The text was updated successfully, but these errors were encountered: