mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-02 08:11:12 +00:00
stop always returning an empty output
This commit is contained in:
parent
1f824f3664
commit
020029138e
1 changed files with 20 additions and 36 deletions
|
@ -278,14 +278,7 @@ pub(crate) fn canonicalize_defs<'a>(
|
||||||
#[allow(clippy::needless_collect)]
|
#[allow(clippy::needless_collect)]
|
||||||
let pending_type_defs = type_defs
|
let pending_type_defs = type_defs
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.filter_map(|loc_def| {
|
.filter_map(|loc_def| to_pending_type_def(env, loc_def.value, &mut scope, pattern_type))
|
||||||
to_pending_type_def(env, loc_def.value, &mut scope, pattern_type).map(
|
|
||||||
|(new_output, pending_def)| {
|
|
||||||
output.union(new_output);
|
|
||||||
pending_def
|
|
||||||
},
|
|
||||||
)
|
|
||||||
})
|
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
if cfg!(debug_assertions) {
|
if cfg!(debug_assertions) {
|
||||||
|
@ -1665,7 +1658,7 @@ fn to_pending_type_def<'a>(
|
||||||
def: &'a ast::TypeDef<'a>,
|
def: &'a ast::TypeDef<'a>,
|
||||||
scope: &mut Scope,
|
scope: &mut Scope,
|
||||||
pattern_type: PatternType,
|
pattern_type: PatternType,
|
||||||
) -> Option<(Output, PendingTypeDef<'a>)> {
|
) -> Option<PendingTypeDef<'a>> {
|
||||||
use ast::TypeDef::*;
|
use ast::TypeDef::*;
|
||||||
|
|
||||||
match def {
|
match def {
|
||||||
|
@ -1713,14 +1706,11 @@ fn to_pending_type_def<'a>(
|
||||||
};
|
};
|
||||||
env.problems.push(problem);
|
env.problems.push(problem);
|
||||||
|
|
||||||
return Some((
|
return Some(PendingTypeDef::InvalidAlias {
|
||||||
Output::default(),
|
kind,
|
||||||
PendingTypeDef::InvalidAlias {
|
symbol,
|
||||||
kind,
|
region,
|
||||||
symbol,
|
});
|
||||||
region,
|
|
||||||
},
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1737,7 +1727,7 @@ fn to_pending_type_def<'a>(
|
||||||
kind,
|
kind,
|
||||||
};
|
};
|
||||||
|
|
||||||
Some((Output::default(), pending_def))
|
Some(pending_def)
|
||||||
}
|
}
|
||||||
|
|
||||||
Err((original_region, loc_shadowed_symbol, new_symbol)) => {
|
Err((original_region, loc_shadowed_symbol, new_symbol)) => {
|
||||||
|
@ -1747,14 +1737,11 @@ fn to_pending_type_def<'a>(
|
||||||
kind: shadow_kind,
|
kind: shadow_kind,
|
||||||
});
|
});
|
||||||
|
|
||||||
Some((
|
Some(PendingTypeDef::InvalidAlias {
|
||||||
Output::default(),
|
kind,
|
||||||
PendingTypeDef::InvalidAlias {
|
symbol: new_symbol,
|
||||||
kind,
|
region,
|
||||||
symbol: new_symbol,
|
})
|
||||||
region,
|
|
||||||
},
|
|
||||||
))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1769,7 +1756,7 @@ fn to_pending_type_def<'a>(
|
||||||
);
|
);
|
||||||
env.problem(Problem::AbilityNotOnToplevel { region });
|
env.problem(Problem::AbilityNotOnToplevel { region });
|
||||||
|
|
||||||
Some((Output::default(), PendingTypeDef::AbilityNotOnToplevel))
|
Some(PendingTypeDef::AbilityNotOnToplevel)
|
||||||
}
|
}
|
||||||
|
|
||||||
Ability {
|
Ability {
|
||||||
|
@ -1790,7 +1777,7 @@ fn to_pending_type_def<'a>(
|
||||||
shadow: shadowed_symbol,
|
shadow: shadowed_symbol,
|
||||||
kind: ShadowKind::Ability,
|
kind: ShadowKind::Ability,
|
||||||
});
|
});
|
||||||
return Some((Output::default(), PendingTypeDef::AbilityShadows));
|
return Some(PendingTypeDef::AbilityShadows);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1802,13 +1789,10 @@ fn to_pending_type_def<'a>(
|
||||||
name: name.value,
|
name: name.value,
|
||||||
variables_region,
|
variables_region,
|
||||||
});
|
});
|
||||||
return Some((
|
return Some(PendingTypeDef::InvalidAbility {
|
||||||
Output::default(),
|
symbol: name.value,
|
||||||
PendingTypeDef::InvalidAbility {
|
region: name.region,
|
||||||
symbol: name.value,
|
});
|
||||||
region: name.region,
|
|
||||||
},
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let pending_ability = PendingTypeDef::Ability {
|
let pending_ability = PendingTypeDef::Ability {
|
||||||
|
@ -1817,7 +1801,7 @@ fn to_pending_type_def<'a>(
|
||||||
members,
|
members,
|
||||||
};
|
};
|
||||||
|
|
||||||
Some((Output::default(), pending_ability))
|
Some(pending_ability)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue