Changeset - 9e91c70a70e2
[Not reviewed]
0 1 0
MH - 4 years ago 2021-05-31 09:19:28
contact@maxhenger.nl
Add small test for inference error
1 file changed with 13 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/protocol/tests/parser_inference.rs
Show inline comments
 
@@ -445,6 +445,19 @@ fn test_explicit_polymorph_argument() {
 
        .call_ok(Some(Value::UInt32(2)));
 
    });
 

	
 
    Tester::new_single_source_expect_err("multi-explicit with array", "
 
    func foo<A, B, C>(A a, B b) -> C {
 
        return (a @ b)[1];
 
    }
 
    func test() -> u32 {
 
        return foo<u32[], u32[], u32, u32>({1}, {2});
 
    }").error(|e| { e
 
        .assert_num(1)
 
        .assert_occurs_at(0, "foo<u32")
 
        .assert_msg_has(0, "expected 3")
 
        .assert_msg_has(0, "4 were provided");
 
    });
 

	
 
    // Failed because type inferencer did not construct polymorph errors by
 
    // considering that argument/return types failed against explicitly
 
    // specified polymorphic arguments
0 comments (0 inline, 0 general)