···43634363 name: EcoString,
43644364 mut arguments: Vec<CallArg<Constant<(), ()>>>,
43654365 ) -> Constant<Arc<Type>, EcoString> {
43664366+ // We start by inferring the value constructor. If we can't do that we
43674367+ // immediately fail and return an invalid node.
43684368+ // TODO: in future we might want to make this more fault tolerant and
43694369+ // still check the arguments even if the constructor itself cannot
43704370+ // be inferred, like we do for expressions!
43664371 let constructor = match self.infer_value_constructor(
43674372 &module,
43684373 &name,
···43774382 return self.new_invalid_constant(location);
43784383 }
43794384 };
43854385+43804386 let (tag, field_map, variant_index) = match &constructor.variant {
43814387 ValueConstructorVariant::Record {
43824388 name,
···43864392 } => (
43874393 name.clone(),
43884394 match field_map {
43894389- Some(fm) => Inferred::Known(fm.clone()),
43954395+ Some(field_map) => Inferred::Known(field_map.clone()),
43904396 None => Inferred::Unknown,
43914397 },
43924398 *variant_index,
···44044410 return literal.clone();
44054411 }
44064412 };
44134413+44074414 // Pretty much all the other infer functions operate on UntypedExpr
44084415 // or TypedExpr rather than ClauseGuard. To make things easier we
44094416 // build the TypedExpr equivalent of the constructor and use that
···44514458 name: name.clone(),
44524459 },
44534460 };
44614461+44544462 // This is basically the same code as do_infer_call_with_known_fun()
44554463 // except the args are typed with infer_clause_guard() here.
44564464 // This duplication is a bit awkward but it works!
···44794487 UnexpectedLabelledArgKind::FunctionParameter,
44804488 ),
44814489 };
44904490+44824491 // If there's an error reordering the fields, or there's labelled
44834492 // arguments with no field map, then we return an invalid expression.
44844493 if let Err(error) = result {
44854494 self.problems.error(error);
44864495 return self.new_invalid_constant(location);
44874496 }
44974497+44884498 let (mut arguments_types, return_type) =
44894499 match match_fun_type(fun.type_(), arguments.len(), self.environment) {
44904500 Ok((arguments_types, return_type)) => (arguments_types, return_type),
···44984508 return self.new_invalid_constant(location);
44994509 }
45004510 };
45114511+45014512 let arguments = arguments_types
45024513 .iter_mut()
45034514 .zip(arguments)
···45244535 }
45254536 })
45264537 .collect_vec();
45384538+45274539 Constant::Record {
45284540 module,
45294541 location,