feat(tvix/eval): Validate closed formals
Validate "closed formals" (formal parameters without an ellipsis) via a new ValidateClosedFormals op, which checks the arguments (in an attr set at the top of the stack) against the formal parameters on the Lambda in the current frame, and returns a new UnexpectedArgument error (including the span of the formals themselves!!) if any arguments aren't allowed Change-Id: Idcc47a59167a83be1832a6229f137d84e426c56c Reviewed-on: https://cl.tvl.fyi/c/depot/+/7002 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
This commit is contained in:
parent
e63d14419f
commit
2a3d498104
7 changed files with 133 additions and 13 deletions
|
|
@ -98,6 +98,12 @@ pub enum OpCode {
|
|||
OpAttrsTrySelect,
|
||||
OpHasAttr,
|
||||
|
||||
/// Throw an error if the attribute set at the top of the stack has any attributes
|
||||
/// other than those listed in the formals of the current lambda
|
||||
///
|
||||
/// Panics if the current frame is not a lambda with formals
|
||||
OpValidateClosedFormals,
|
||||
|
||||
// `with`-handling
|
||||
OpPushWith(StackIdx),
|
||||
OpPopWith,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue