-
Notifications
You must be signed in to change notification settings - Fork 36
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
add some wf checks for fn types #181
base: main
Are you sure you want to change the base?
Conversation
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.
Basically looks good — are there any tests for function WF though? Also, the debug impl didn't quite look like what I expected, which is to output fn name<...>
and fn(...)
. I think it will just emit name<...>
and (...)
?
@@ -20,13 +20,13 @@ fn decls() -> Decls { | |||
fn direct_cycle() { | |||
test_prove(decls(), term("exists<ty A> {} => {A = Vec<A>}")).assert_err( | |||
expect![[r#" | |||
judgment `prove_wc_list { goal: {?ty_0 = Vec<?ty_0>}, assumptions: {}, env: Env { variables: [?ty_0], bias: Soundness }, decls: decls(222, [trait Foo <ty> ], [impl <ty> Foo(Vec<^ty0_0>)], [], [], [], [], {}, {}) }` failed at the following rule(s): |
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 should probably cleanup the Env
Debug impl to e.g. suppress empty lists...
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.
#187 smaller decls output
src/test/functions.rs
Outdated
fn wf() { | ||
crate::assert_ok!( | ||
[ | ||
crate Foo { | ||
fn foo<ty T>() -> T { trusted } | ||
fn bar(fn foo<u32>, fn(u32) -> (), fn(bool)) -> () { trusted } | ||
} | ||
] | ||
|
||
expect_test::expect![[r#" | ||
judgment `prove_wc_list { goal: {@ wf(&!lt_0 !ty_1)}, assumptions: {}, env: Env { variables: [!lt_0, !ty_1], bias: Soundness }, decls: decls(222, [], [], [], [], [], [], {}, {}) }` failed at the following rule(s): | ||
the rule "some" failed at step #0 (src/file.rs:LL:CC) because | ||
judgment `prove_wc { goal: @ wf(&!lt_0 !ty_1), assumptions: {}, env: Env { variables: [!lt_0, !ty_1], bias: Soundness }, decls: decls(222, [], [], [], [], [], [], {}, {}) }` failed at the following rule(s): | ||
the rule "parameter well formed" failed at step #0 (src/file.rs:LL:CC) because | ||
judgment had no applicable rules: `prove_wf { goal: &!lt_0 !ty_1, assumptions: {}, env: Env { variables: [!lt_0, !ty_1], bias: Soundness }, decls: decls(222, [], [], [], [], [], [], {}, {}) }`"#]] | ||
expect_test::expect!["()"] |
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.
@nikomatsakis this is a test for fn well-formed. I can also add some tests for catching poorly formed fns.
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.
mind blocking this PR on #187 (comment) reviewing it with most of the changes being an added []
to decls isn't great
good time for re-review @lcnr or @nikomatsakis ? |
Yes! I have been very absent from a-mir-formality but I'm looking to jump back in and figure out next steps soon-ish anyway, so it is a good time.
…On Thu, Oct 17, 2024, at 1:20 PM, shua wrote:
good time for re-review @lcnr <https://github.com/lcnr> or @nikomatsakis <https://github.com/nikomatsakis> ?
—
Reply to this email directly, view it on GitHub <#181 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AABF4ZQUX5NRP6N45S7MWWTZ37WXDAVCNFSM6AAAAABKH4ENP2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMRQGA4TEMRRG4>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
This change adds a syntax for specifying FnDefs and FnPtrs as type parameters,
fn name<T, U, ...>
andfn(T, U,...) -> V
respectively. Thefn
prefix is used to disambiguate between adt identifiers. In addition, some relevant well-formed cases have been added.