rib/type_checker/
mod.rs

1// Copyright 2024-2025 Golem Cloud
2//
3// Licensed under the Golem Source License v1.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://license.golem.cloud/LICENSE
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15pub(crate) use exhaustive_pattern_match::*;
16pub(crate) use unresolved_types::*;
17
18pub use path::*;
19mod exhaustive_pattern_match;
20mod invalid_function_args;
21mod invalid_function_calls;
22mod invalid_worker_name;
23mod missing_fields;
24mod path;
25mod unresolved_types;
26
27use crate::rib_type_error::RibTypeErrorInternal;
28use crate::type_checker::exhaustive_pattern_match::check_exhaustive_pattern_match;
29use crate::type_checker::invalid_function_args::check_invalid_function_args;
30use crate::type_checker::invalid_function_calls::check_invalid_function_calls;
31use crate::type_checker::invalid_worker_name::check_invalid_worker_name;
32use crate::{ComponentDependencies, Expr};
33
34pub fn type_check(
35    expr: &mut Expr,
36    component_dependency: &ComponentDependencies,
37) -> Result<(), RibTypeErrorInternal> {
38    check_invalid_function_args(expr, component_dependency)?;
39    check_unresolved_types(expr)?;
40    check_invalid_worker_name(expr)?;
41    check_exhaustive_pattern_match(expr, component_dependency)?;
42    check_invalid_function_calls(expr)?;
43    Ok(())
44}