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

TyRoXx / NonlocalityOS / 14819360957

04 May 2025 08:23AM UTC coverage: 73.132% (+0.1%) from 72.986%
14819360957

push

github

TyRoXx
Introduce an AST to the parser

57 of 65 new or added lines in 5 files covered. (87.69%)

7 existing lines in 3 files now uncovered.

3073 of 4202 relevant lines covered (73.13%)

2257.48 hits per line

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

93.55
/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 std::sync::Arc;
7

8
pub async fn check_types(
18✔
9
    syntax_tree: &ast::Expression,
10
    storage: &dyn StoreTree,
11
) -> Result<CompilerOutput, StoreError> {
12
    match syntax_tree {
18✔
13
        ast::Expression::Identifier(name) => Ok(CompilerOutput::new(
7✔
14
            Some(lambda::expressions::DeepExpression(
7✔
15
                lambda::expressions::Expression::ReadVariable(name.clone()),
7✔
16
            )),
17
            Vec::new(),
7✔
18
        )),
19
        ast::Expression::StringLiteral(value) => Ok(CompilerOutput::new(
4✔
20
            Some(lambda::expressions::DeepExpression(
21
                lambda::expressions::Expression::Literal(
22
                    storage
2✔
23
                        .store_tree(&HashedTree::from(Arc::new(
2✔
24
                            Tree::from_string(value).unwrap(/*TODO*/),
2✔
25
                        )))
26
                        .await?,
2✔
27
                ),
28
            )),
29
            Vec::new(),
30
        )),
31
        ast::Expression::Apply { callee, argument } => {
3✔
32
            let callee_output = Box::pin(check_types(callee, storage)).await?;
6✔
33
            let argument_output = Box::pin(check_types(argument, storage)).await?;
3✔
34
            let errors = callee_output
35
                .errors
36
                .into_iter()
37
                .chain(argument_output.errors)
38
                .collect();
39
            match (callee_output.entry_point, argument_output.entry_point) {
40
                (Some(callee_checked), Some(argument_checked)) => Ok(CompilerOutput {
3✔
41
                    entry_point: Some(lambda::expressions::DeepExpression(
3✔
42
                        lambda::expressions::Expression::Apply {
3✔
43
                            callee: Arc::new(callee_checked),
3✔
44
                            argument: Arc::new(argument_checked),
3✔
45
                        },
46
                    )),
47
                    errors: errors,
3✔
48
                }),
NEW
49
                (None, _) | (_, None) => return Ok(CompilerOutput::new(None, errors)),
×
50
            }
51
        }
52
        ast::Expression::Lambda {
53
            parameter_name,
6✔
54
            body,
6✔
55
        } => {
56
            let body_output = Box::pin(check_types(body, storage)).await?;
12✔
57
            match body_output.entry_point {
58
                Some(body_checked) => Ok(CompilerOutput {
6✔
59
                    entry_point: Some(lambda::expressions::DeepExpression(
6✔
60
                        lambda::expressions::Expression::Lambda {
6✔
61
                            parameter_name: parameter_name.clone(),
6✔
62
                            body: Arc::new(body_checked),
6✔
63
                        },
64
                    )),
65
                    errors: body_output.errors,
6✔
66
                }),
NEW
67
                None => return Ok(CompilerOutput::new(None, body_output.errors)),
×
68
            }
69
        }
70
    }
71
}
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