luaur_analysis/functions/
is_overloaded_function.rs1use crate::functions::flatten_intersection::flatten_intersection;
5use crate::functions::follow_type::follow;
6use crate::functions::get_type_alt_j::get;
7use crate::records::function_type::FunctionType;
8use crate::records::intersection_type::IntersectionType;
9use crate::type_aliases::type_id::TypeId;
10
11pub fn is_overloaded_function(ty: TypeId) -> bool {
12 unsafe {
13 if get::<IntersectionType>(follow(ty)).is_null() {
14 return false;
15 }
16
17 let parts = flatten_intersection(ty);
18 parts
19 .iter()
20 .all(|&part| !get::<FunctionType>(part).is_null())
21 }
22}