mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 13:29:12 +00:00
Use new try impl for ? operator
This commit is contained in:
parent
193c23bac8
commit
de626102c8
20 changed files with 429 additions and 110 deletions
|
@ -2,6 +2,7 @@
|
|||
use std::{path::PathBuf, str::Utf8Error};
|
||||
|
||||
use roc_can::constraint::{ExpectEffectfulReason, FxSuffixKind};
|
||||
use roc_can::expr::TryKind;
|
||||
use roc_can::{
|
||||
constraint::FxCallKind,
|
||||
expected::{Expected, PExpected},
|
||||
|
@ -48,7 +49,7 @@ pub enum TypeError {
|
|||
ExpectedEffectful(Region, ExpectEffectfulReason),
|
||||
UnsuffixedEffectfulFunction(Region, FxSuffixKind),
|
||||
SuffixedPureFunction(Region, FxSuffixKind),
|
||||
InvalidTryTarget(Region, ErrorType),
|
||||
InvalidTryTarget(Region, ErrorType, TryKind),
|
||||
}
|
||||
|
||||
impl TypeError {
|
||||
|
@ -78,7 +79,7 @@ impl TypeError {
|
|||
TypeError::FxInTopLevel(_, _) => Warning,
|
||||
TypeError::UnsuffixedEffectfulFunction(_, _) => Warning,
|
||||
TypeError::SuffixedPureFunction(_, _) => Warning,
|
||||
TypeError::InvalidTryTarget(_, _) => RuntimeError,
|
||||
TypeError::InvalidTryTarget(_, _, _) => RuntimeError,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -100,7 +101,7 @@ impl TypeError {
|
|||
| TypeError::ExpectedEffectful(region, _)
|
||||
| TypeError::UnsuffixedEffectfulFunction(region, _)
|
||||
| TypeError::SuffixedPureFunction(region, _)
|
||||
| TypeError::InvalidTryTarget(region, _) => Some(*region),
|
||||
| TypeError::InvalidTryTarget(region, _, _) => Some(*region),
|
||||
TypeError::UnfulfilledAbility(ab, ..) => ab.region(),
|
||||
TypeError::Exhaustive(e) => Some(e.region()),
|
||||
TypeError::CircularDef(c) => c.first().map(|ce| ce.symbol_region),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue