⭐️ A friendly language for building type-safe, scalable systems!

remove overlapping functions

there was a `is_record_constructor` function that did basically the same
as `is_record_builder` but was more limited (e.g. couldn't understand a
module select was still a record builder). So I removed that function
and replaced its usage with the better `is_record_builder`

authored by giacomocavalieri.me and committed by Louis Pilfold fb31ff58 3f7cc0c1

Changed files
+3 -22
compiler-core
+1 -18
compiler-core/src/ast/typed.rs
··· 676 676 677 677 // Calls are literals if they are records and all the arguemnts are also literals. 678 678 Self::Call { fun, args, .. } => { 679 - fun.is_record_constructor() 680 - && args.iter().all(|argument| argument.value.is_literal()) 679 + fun.is_record_builder() && args.iter().all(|argument| argument.value.is_literal()) 681 680 } 682 681 683 682 // Variables are literals if they are record constructors that take no arguments. ··· 909 908 | TypedExpr::NegateBool { .. } 910 909 | TypedExpr::NegateInt { .. } 911 910 | TypedExpr::Invalid { .. } => Purity::Unknown, 912 - } 913 - } 914 - 915 - #[must_use] 916 - // TODO)) is this the same as is_record_builder 917 - pub fn is_record_constructor(&self) -> bool { 918 - match self { 919 - TypedExpr::Var { 920 - constructor: 921 - ValueConstructor { 922 - variant: ValueConstructorVariant::Record { .. }, 923 - .. 924 - }, 925 - .. 926 - } => true, 927 - _ => false, 928 911 } 929 912 } 930 913
+2 -4
compiler-core/src/type_/tests/snapshots/gleam_core__type___tests__warnings__unused_module_select_constructor_call.snap
··· 17 17 18 18 19 19 ----- WARNING 20 - warning: Unused value 20 + warning: Unused literal 21 21 ┌─ /src/warning/wrn.gleam:5:3 22 22 23 23 5 │ wibble.Wibble(1) 24 24 │ ^^^^^^^^^^^^^^^^ This value is never used 25 25 26 - This expression computes a value without any side effects, but then the 27 - value isn't used at all. You might want to assign it to a variable, or 28 - delete the expression entirely if it's not needed. 26 + Hint: You can safely remove it.