test273
auto test273 =
q{--- test273.vx
// named arguments, error cases
i32 func(i32 param1, i32 param2, i32 param3) { return param1 * 40 + param2 * 20 + param3; }
i32 call_1() { return func(param4: 4, 1, 2); } // nonexisting named parameter
i32 call_2() { return func(param2: 2, 1, 3); } // setting parameter 4, param1 not set
i32 call_3() { return func(param3: 3, 1, 2); } // setting parameter 4 and 5, params 1 and 2 not set
i32 call_4() { return func(param1: 1, param1: 1, 2); } // setting parameter 1 twice
--- <error>
test273.vx:3:29: Error: Function `func` has no parameter named `param4`
test273.vx:3:28: Error: Missing argument for parameter 1: `param1`
test273.vx:3:28: Error: Missing argument for parameter 2: `param2`
test273.vx:3:28: Error: Missing argument for parameter 3: `param3`
test273.vx:4:43: Error: Trying to provide parameter 4, while `func` has 3 parameters
test273.vx:4:28: Error: Missing argument for parameter 1: `param1`
test273.vx:5:40: Error: Trying to provide parameter 4, while `func` has 3 parameters
test273.vx:5:43: Error: Trying to provide parameter 5, while `func` has 3 parameters
test273.vx:5:28: Error: Missing argument for parameter 1: `param1`
test273.vx:5:28: Error: Missing argument for parameter 2: `param2`
test273.vx:6:40: Error: Parameter `param1` provided several times
test273.vx:6:28: Error: Missing argument for parameter 3: `param3`
};
tests passing
functionsvariables