Fork of daniellemaywood.uk/gleam — Wasm codegen work
2

Configure Feed

Select the types of activity you want to include in your feed.

some comments and spaces

author
Giacomo Cavalieri
committer
Louis Pilfold
date (May 21, 2026, 12:59 PM +0100) commit 255845a5 parent aaf5a228 change-id mnprqmul
+13 -1
+13 -1
compiler-core/src/type_/expression.rs
··· 4363 4363 name: EcoString, 4364 4364 mut arguments: Vec<CallArg<Constant<(), ()>>>, 4365 4365 ) -> Constant<Arc<Type>, EcoString> { 4366 + // We start by inferring the value constructor. If we can't do that we 4367 + // immediately fail and return an invalid node. 4368 + // TODO: in future we might want to make this more fault tolerant and 4369 + // still check the arguments even if the constructor itself cannot 4370 + // be inferred, like we do for expressions! 4366 4371 let constructor = match self.infer_value_constructor( 4367 4372 &module, 4368 4373 &name, ··· 4377 4382 return self.new_invalid_constant(location); 4378 4383 } 4379 4384 }; 4385 + 4380 4386 let (tag, field_map, variant_index) = match &constructor.variant { 4381 4387 ValueConstructorVariant::Record { 4382 4388 name, ··· 4386 4392 } => ( 4387 4393 name.clone(), 4388 4394 match field_map { 4389 - Some(fm) => Inferred::Known(fm.clone()), 4395 + Some(field_map) => Inferred::Known(field_map.clone()), 4390 4396 None => Inferred::Unknown, 4391 4397 }, 4392 4398 *variant_index, ··· 4404 4410 return literal.clone(); 4405 4411 } 4406 4412 }; 4413 + 4407 4414 // Pretty much all the other infer functions operate on UntypedExpr 4408 4415 // or TypedExpr rather than ClauseGuard. To make things easier we 4409 4416 // build the TypedExpr equivalent of the constructor and use that ··· 4451 4458 name: name.clone(), 4452 4459 }, 4453 4460 }; 4461 + 4454 4462 // This is basically the same code as do_infer_call_with_known_fun() 4455 4463 // except the args are typed with infer_clause_guard() here. 4456 4464 // This duplication is a bit awkward but it works! ··· 4479 4487 UnexpectedLabelledArgKind::FunctionParameter, 4480 4488 ), 4481 4489 }; 4490 + 4482 4491 // If there's an error reordering the fields, or there's labelled 4483 4492 // arguments with no field map, then we return an invalid expression. 4484 4493 if let Err(error) = result { 4485 4494 self.problems.error(error); 4486 4495 return self.new_invalid_constant(location); 4487 4496 } 4497 + 4488 4498 let (mut arguments_types, return_type) = 4489 4499 match match_fun_type(fun.type_(), arguments.len(), self.environment) { 4490 4500 Ok((arguments_types, return_type)) => (arguments_types, return_type), ··· 4498 4508 return self.new_invalid_constant(location); 4499 4509 } 4500 4510 }; 4511 + 4501 4512 let arguments = arguments_types 4502 4513 .iter_mut() 4503 4514 .zip(arguments) ··· 4524 4535 } 4525 4536 }) 4526 4537 .collect_vec(); 4538 + 4527 4539 Constant::Record { 4528 4540 module, 4529 4541 location,