diff --git a/src/protocol/tests/parser_inference.rs b/src/protocol/tests/parser_inference.rs index 44dcd85a51a0797fed6e79151940b2c57e4bd322..282c19626d328bee46016db1bfc4bd816a387c0c 100644 --- a/src/protocol/tests/parser_inference.rs +++ b/src/protocol/tests/parser_inference.rs @@ -468,6 +468,56 @@ fn test_failed_polymorph_inference() { ); } +#[test] +fn test_disallowed_inference() { + Tester::new_single_source_expect_err( + "argument auto inference", + "func thing(auto arg) -> s32 { return 0; }" + ).error(|e| { e + .assert_msg_has(0, "inference is not allowed") + .assert_occurs_at(0, "auto arg"); + }); + + Tester::new_single_source_expect_err( + "return type auto inference", + "func thing(s32 arg) -> auto { return 0; }" + ).error(|e| { e + .assert_msg_has(0, "inference is not allowed") + .assert_occurs_at(0, "auto {"); + }); + + Tester::new_single_source_expect_err( + "implicit polymorph argument auto inference", + "func thing(in port) -> s32 { return port; }" + ).error(|e| { e + .assert_msg_has(0, "inference is not allowed") + .assert_occurs_at(0, "in port"); + }); + + Tester::new_single_source_expect_err( + "explicit polymorph argument auto inference", + "func thing(in port) -> s32 { return port; }" + ).error(|e| { e + .assert_msg_has(0, "inference is not allowed") + .assert_occurs_at(0, "auto> port"); + }); + + Tester::new_single_source_expect_err( + "implicit polymorph return type auto inference", + "func thing(in a, in b) -> in { return a; }" + ).error(|e| { e + .assert_msg_has(0, "inference is not allowed") + .assert_occurs_at(0, "in {"); + }); + + Tester::new_single_source_expect_err( + "explicit polymorph return type auto inference", + "func thing(in a) -> in { return a; }" + ).error(|e| { e + .assert_msg_has(0, "inference is not allowed") + .assert_occurs_at(0, "auto> {"); + }); +} #[test] fn test_explicit_polymorph_argument() {