Skip to content
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

Merged
merged 25 commits into from
Jul 26, 2024
Merged

Fixed cols in functions #1545

merged 25 commits into from
Jul 26, 2024

Conversation

chriseth
Copy link
Member

@chriseth chriseth commented Jul 8, 2024

No description provided.

gzanitti added a commit to gzanitti/powdr that referenced this pull request Jul 10, 2024
@chriseth chriseth marked this pull request as ready for review July 10, 2024 20:31
"#;
let output = asm_string_to_pil::<GoldilocksField>(input).to_string();
let expected = " 2 = 0;\n";
assert_eq!(output, expected);
Copy link
Member

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?

Copy link
Member Author

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

";
type_check(input, &[]);
}
// TODO also check type vars used in types and also check this all for asm code.
Copy link
Member

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here or after?

Copy link
Member Author

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()));
Copy link
Member

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a test.

Copy link
Member

@leonardoalt leonardoalt Jul 26, 2024

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

Copy link
Member

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}.")))
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a test.

Copy link
Member Author

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?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Err sounds better

@chriseth
Copy link
Member Author

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.

@chriseth chriseth added this pull request to the merge queue Jul 26, 2024
Merged via the queue into main with commit d1924ec Jul 26, 2024
14 checks passed
@chriseth chriseth deleted the fixed_cols_in_functions branch July 26, 2024 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants