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

Type inference ignores generic arguments #1551

Merged
merged 1 commit into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion importer/src/path_canonicalizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ fn canonicalize_inside_expression(
Expression::Reference(_, reference) => {
// If resolving the reference fails, we assume it is a local variable that has been checked below.
if let Some(n) = paths.get(&path.clone().join(reference.path.clone())) {
*reference = n.relative_to(&Default::default()).into();
reference.path = n.relative_to(&Default::default());
} else {
assert!(reference.path.try_to_identifier().is_some());
}
Expand Down
6 changes: 6 additions & 0 deletions pipeline/tests/asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -731,3 +731,9 @@ fn connect_no_witgen() {
let i = [];
verify_asm(f, slice_to_vec(&i));
}

#[test]
fn generics_preservation() {
let f = "asm/generics_preservation.asm";
verify_asm(f, Default::default());
Copy link
Collaborator Author

@gzanitti gzanitti Jul 9, 2024

Choose a reason for hiding this comment

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

Is there anything else to take out of here? Or maybe I should remove/move the test somewhere else?

Copy link
Member

Choose a reason for hiding this comment

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

I think we don't really have good tests for assembly apart from the pipeline tests. You can see if you can find a better place also for future tests

}
20 changes: 20 additions & 0 deletions test_data/asm/generics_preservation.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
mod cols {
enum Generic<T> {
A(T),
B,
}
let<T> f: -> Generic<T> = || {
Generic::B
};
}


machine Empty {
let x;
let fi: col = |i| match cols::f::<int>() {
cols::Generic::A(_) => 7,
cols::Generic::B => 9,
};
x = fi;

}
Loading