nac3core: fix broken tests

This commit is contained in:
ychenfo 2022-01-13 03:21:26 +08:00
parent 4a1a4dc076
commit ae8f82ccb0
3 changed files with 11 additions and 7 deletions

View File

@ -46,8 +46,8 @@ impl SymbolResolver for Resolver {
_: &[Arc<RwLock<TopLevelDef>>],
_: &PrimitiveStore,
str: StrRef,
) -> Option<Type> {
self.id_to_type.get(&str).cloned()
) -> Result<Type, String> {
self.id_to_type.get(&str).cloned().ok_or_else(|| format!("cannot find symbol `{}`", str))
}
fn get_symbol_value<'ctx, 'a>(

View File

@ -45,9 +45,13 @@ impl SymbolResolver for Resolver {
_: &[Arc<RwLock<TopLevelDef>>],
_: &PrimitiveStore,
str: StrRef,
) -> Option<Type> {
let ret = self.0.id_to_type.lock().get(&str).cloned();
ret
) -> Result<Type, String> {
self.0
.id_to_type
.lock()
.get(&str)
.cloned()
.ok_or_else(|| format!("cannot find symbol `{}`", str))
}
fn get_symbol_value<'ctx, 'a>(

View File

@ -29,8 +29,8 @@ impl SymbolResolver for Resolver {
_: &[Arc<RwLock<TopLevelDef>>],
_: &PrimitiveStore,
str: StrRef,
) -> Option<Type> {
self.id_to_type.get(&str).cloned()
) -> Result<Type, String> {
self.id_to_type.get(&str).cloned().ok_or_else(|| format!("cannot find symbol `{}`", str))
}
fn get_symbol_value<'ctx, 'a>(