-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed cols in functions #1545
Fixed cols in functions #1545
Conversation
019c570
to
53f3d76
Compare
9e052ff
to
dd3b250
Compare
ab28754
to
0e6af5c
Compare
"#; | ||
let output = asm_string_to_pil::<GoldilocksField>(input).to_string(); | ||
let expected = " 2 = 0;\n"; | ||
assert_eq!(output, expected); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this test should be moved to one of the compiler crates instead of Pipeline which does end-to-end stuff?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't have a crate that spans asm and pil, so pipeline is the correct crate IMO
pil-analyzer/tests/types.rs
Outdated
"; | ||
type_check(input, &[]); | ||
} | ||
// TODO also check type vars used in types and also check this all for asm code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this PR or future?
(None, Some(value)) => self.infer_type_of_expression(value)?, | ||
(Some(ty), None) => { | ||
if *ty != Type::Col { | ||
// TODO better source ref |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here or after?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
after
(Some(ty), None) => { | ||
if *ty != Type::Col { | ||
// TODO better source ref | ||
return Err(source_ref.with_error("Let-declared variables without value must have type 'col'.".to_string())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a test that reaches this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where? I don't see a diff from my latest review
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah now
type_scheme: None, | ||
})) | ||
} else { | ||
Err(EvalError::TypeError(format!("Only lambda expressions are allowed for dynamically-created fixed columns. Got {v}."))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a test that reaches this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so, it should not be able to pass the type checker.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I change this here to panic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Err sounds better
It seems that the type inference algorithm does not assign types to local variables (i.e. it does not modify the ast there). I think it should. Will add that. |
No description provided.