luaur-analysis 0.1.3

Luau type checker and type inference (Rust).
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
use crate::type_aliases::refinement_map::RefinementMap;
use crate::type_aliases::type_id::TypeId;

pub fn merge(l: &mut RefinementMap, r: &RefinementMap, f: &dyn Fn(TypeId, TypeId) -> TypeId) {
    for (k, a) in r {
        if let Some(existing) = l.get_mut(k) {
            *existing = f(*existing, *a);
        } else {
            l.insert(k.clone(), *a);
        }
    }
}