• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

TyRoXx / NonlocalityOS / 14945234271

10 May 2025 12:15PM UTC coverage: 71.79% (+0.2%) from 71.585%
14945234271

push

github

TyRoXx
GH-242: Enforce code style with cargo clippy

129 of 193 new or added lines in 25 files covered. (66.84%)

4 existing lines in 4 files now uncovered.

3097 of 4314 relevant lines covered (71.79%)

2252.93 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

92.59
/lambda_compiler/src/type_checking.rs
1
use crate::{ast, compilation::CompilerOutput};
2
use astraea::{
3
    storage::{StoreError, StoreTree},
4
    tree::{HashedTree, Tree},
5
};
6
use lambda::name::{Name, NamespaceId};
7
use std::sync::Arc;
8

9
pub fn combine_parameter_names(parameter_names: &[Name], namespace_id: &NamespaceId) -> Name {
15✔
10
    let mut combined = String::new();
15✔
11
    for name in parameter_names {
35✔
12
        if !combined.is_empty() {
2✔
13
            combined.push('_');
2✔
14
        }
15
        combined.push_str(&name.key);
16
    }
17
    Name::new(*namespace_id, combined)
15✔
18
}
19

20
pub async fn check_types(
34✔
21
    syntax_tree: &ast::Expression,
22
    generated_name_namespace: &NamespaceId,
23
    storage: &dyn StoreTree,
24
) -> Result<CompilerOutput, StoreError> {
25
    match syntax_tree {
34✔
26
        ast::Expression::Identifier(name) => Ok(CompilerOutput::new(
8✔
27
            Some(lambda::expressions::DeepExpression(
8✔
28
                lambda::expressions::Expression::ReadVariable(name.clone()),
8✔
29
            )),
30
            Vec::new(),
8✔
31
        )),
32
        ast::Expression::StringLiteral(value) => Ok(CompilerOutput::new(
12✔
33
            Some(lambda::expressions::DeepExpression(
34
                lambda::expressions::Expression::Literal(
35
                    storage
6✔
36
                        .store_tree(&HashedTree::from(Arc::new(
6✔
37
                            Tree::from_string(value).unwrap(/*TODO*/),
6✔
38
                        )))
39
                        .await?,
6✔
40
                ),
41
            )),
42
            Vec::new(),
43
        )),
44
        ast::Expression::Apply { callee, argument } => {
2✔
45
            let callee_output =
2✔
46
                Box::pin(check_types(callee, generated_name_namespace, storage)).await?;
2✔
47
            let argument_output =
2✔
48
                Box::pin(check_types(argument, generated_name_namespace, storage)).await?;
×
49
            let errors = callee_output
50
                .errors
51
                .into_iter()
52
                .chain(argument_output.errors)
53
                .collect();
54
            match (callee_output.entry_point, argument_output.entry_point) {
55
                (Some(callee_checked), Some(argument_checked)) => Ok(CompilerOutput {
2✔
56
                    entry_point: Some(lambda::expressions::DeepExpression(
2✔
57
                        lambda::expressions::Expression::Apply {
2✔
58
                            callee: Arc::new(callee_checked),
2✔
59
                            argument: Arc::new(argument_checked),
2✔
60
                        },
61
                    )),
62
                    errors,
2✔
63
                }),
NEW
64
                (None, _) | (_, None) => Ok(CompilerOutput::new(None, errors)),
×
65
            }
66
        }
67
        ast::Expression::Lambda {
68
            parameter_names,
12✔
69
            body,
12✔
70
        } => {
71
            let body_output =
12✔
72
                Box::pin(check_types(body, generated_name_namespace, storage)).await?;
12✔
73
            match body_output.entry_point {
74
                Some(body_checked) => Ok(CompilerOutput {
12✔
75
                    entry_point: Some(lambda::expressions::DeepExpression(
12✔
76
                        lambda::expressions::Expression::Lambda {
12✔
77
                            parameter_name: combine_parameter_names(
12✔
78
                                &parameter_names[..],
12✔
79
                                generated_name_namespace,
12✔
80
                            ),
81
                            body: Arc::new(body_checked),
12✔
82
                        },
83
                    )),
84
                    errors: body_output.errors,
12✔
85
                }),
NEW
86
                None => Ok(CompilerOutput::new(None, body_output.errors)),
×
87
            }
88
        }
89
        ast::Expression::ConstructTree(expressions) => {
6✔
90
            let mut errors = Vec::new();
6✔
91
            let mut children = Vec::new();
6✔
92
            for expression in expressions {
18✔
93
                let output =
6✔
94
                    Box::pin(check_types(expression, generated_name_namespace, storage)).await?;
6✔
95
                errors.extend(output.errors);
96
                if let Some(checked) = output.entry_point {
6✔
97
                    children.push(Arc::new(checked));
98
                } else {
99
                    return Ok(CompilerOutput::new(None, errors));
×
100
                }
101
            }
102
            Ok(CompilerOutput {
6✔
103
                entry_point: Some(lambda::expressions::DeepExpression(
6✔
104
                    lambda::expressions::Expression::ConstructTree(children),
6✔
105
                )),
106
                errors,
6✔
107
            })
108
        }
109
    }
110
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc