Do not warn about pure functions in suffixed record literal fields

Records fields that allow effectful functions, should also accept
pure functions.
This commit is contained in:
Agus Zubiaga 2024-11-09 01:05:06 -03:00
parent 119663b3e7
commit 12c735644f
No known key found for this signature in database
6 changed files with 61 additions and 48 deletions

View file

@ -618,15 +618,10 @@ impl Constraints {
Constraint::FxSuffix(constraint_index)
}
pub fn fx_record_field_suffix(
&mut self,
suffix: IdentSuffix,
variable: Variable,
region: Region,
) -> Constraint {
pub fn fx_record_field_unsuffixed(&mut self, variable: Variable, region: Region) -> Constraint {
let type_index = Self::push_type_variable(variable);
let constraint = FxSuffixConstraint {
kind: FxSuffixKind::RecordField(suffix),
kind: FxSuffixKind::UnsuffixedRecordField,
type_index,
region,
};
@ -952,14 +947,14 @@ pub struct FxSuffixConstraint {
pub enum FxSuffixKind {
Let(Symbol),
Pattern(Symbol),
RecordField(IdentSuffix),
UnsuffixedRecordField,
}
impl FxSuffixKind {
pub fn suffix(&self) -> IdentSuffix {
match self {
Self::Let(symbol) | Self::Pattern(symbol) => symbol.suffix(),
Self::RecordField(suffix) => *suffix,
Self::UnsuffixedRecordField => IdentSuffix::None,
}
}
}