Skip to content

Commit

Permalink
feat(sol-driver): fix church encoding tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aripiprazole committed May 8, 2024
1 parent 91974b8 commit 19fff4a
Show file tree
Hide file tree
Showing 2 changed files with 167 additions and 27 deletions.
160 changes: 160 additions & 0 deletions sol-driver/suite/church_encoding.expect
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
Error: found 1 errors
╭─[unresolved:1:1]
β”‚
1 β”‚
β”‚ β”‚
β”‚ ╰─ resolution error: Empty expression representation is not allowed to be used in any contexts
───╯
Error: found 64 errors
╭─[repl:1:1]
β”‚
2 β”‚ Nat : * = (n : *) -> (n -> n) -> n
β”‚ │┬── ┬──── ┬ ┬ ┬
β”‚ ╰────────────────────────────── parse error: (missing "return")
β”‚ β”‚ β”‚ β”‚ β”‚ β”‚
β”‚ ╰───────────────────────────── resolution error: unresolved `function` `* =`
β”‚ β”‚ β”‚ β”‚ β”‚
β”‚ ╰──────────────────────── parse error: unexpected token(s): n : *
β”‚ β”‚ β”‚ β”‚
β”‚ ╰───────────── resolution error: unresolved `type` `n`
β”‚ β”‚ β”‚
β”‚ ╰──────── resolution error: unresolved `type` `n`
β”‚ β”‚
β”‚ ╰── resolution error: unresolved `type` `n`
β”‚
4 β”‚ Succ (prev : Nat) : Nat = |n succ# zero#|
β”‚ ┬ ┬ ┬ ┬─
β”‚ ╰────────────────── resolution error: unresolved `function` `=`
β”‚ β”‚ β”‚ β”‚
β”‚ ╰─────────────── resolution error: unresolved `constructor` `n`
β”‚ β”‚ β”‚
β”‚ ╰───────── parse error: unexpected token(s): #
β”‚ β”‚
β”‚ ╰─── parse error: unexpected token(s): # |
5 β”‚ succ# (prev n succ# zero#) zero#
β”‚ ┬ ┬─── ┬ ┬ ┬
β”‚ ╰───────────────────────────── parse error: unexpected token(s): #
β”‚ β”‚ β”‚ β”‚ β”‚
β”‚ ╰────────────────────────── resolution error: unresolved `constructor` `prev`
β”‚ β”‚ β”‚ β”‚
β”‚ ╰─────────────── parse error: unexpected token(s): #
β”‚ β”‚ β”‚
β”‚ ╰───────── parse error: unexpected token(s): #
β”‚ β”‚
β”‚ ╰── parse error: unexpected token(s): #
β”‚
7 β”‚ Zero : Nat = |n succ# zero#|
β”‚ ┬ ┬ ┬ ┬─
β”‚ ╰────────────────── resolution error: unresolved `function` `=`
β”‚ β”‚ β”‚ β”‚
β”‚ ╰─────────────── resolution error: unresolved `constructor` `n`
β”‚ β”‚ β”‚
β”‚ ╰───────── parse error: unexpected token(s): #
β”‚ β”‚
β”‚ ╰─── parse error: unexpected token(s): # |
8 β”‚ zero#
β”‚ ┬
β”‚ ╰── parse error: unexpected token(s): #
β”‚
11 β”‚ Maybe (t : *) = (a : *) -> (t -> a) a -> a
β”‚ ┬── ┬ ┬── ┬─ ┬ ┬─ ┬─
β”‚ ╰──────────────────────────────── parse error: unexpected token(s): : *
β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚
β”‚ ╰─────────────────────────── parse error: unexpected token(s): =
β”‚ β”‚ β”‚ β”‚ β”‚ β”‚
β”‚ ╰────────────────────── parse error: unexpected token(s): : *
β”‚ β”‚ β”‚ β”‚ β”‚
β”‚ ╰───────────────── parse error: unexpected token(s): - >
β”‚ β”‚ β”‚ β”‚
β”‚ ╰───────────── resolution error: unresolved `constructor` `t`
β”‚ β”‚ β”‚
β”‚ ╰─────────── parse error: unexpected token(s): - >
β”‚ β”‚
β”‚ ╰─── parse error: unexpected token(s): - >
β”‚
13 β”‚ Just (value : a) : Maybe a = Just @ |t just# nothing#|
β”‚ ┬──── ┬ ┬──── ┬ ┬ ┬─── ┬ ┬ ┬───┬ ┬──────┬
β”‚ ╰──────────────────────────────────────────────── resolution error: unresolved `constructor` `value`
β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚
β”‚ ╰────────────────────────────────────────── parse error: unexpected token(s): :
β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚
β”‚ ╰─────────────────────────────────── resolution error: unresolved `type` `Maybe`
β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚
β”‚ ╰───────────────────────────── resolution error: unresolved `type` `a`
β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚
β”‚ ╰─────────────────────────── resolution error: unresolved `function` `=`
β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚
β”‚ ╰───────────────────────── resolution error: unresolved `type` `Just`
β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚
β”‚ ╰──────────────────── parse error: unexpected token(s): @
β”‚ β”‚ β”‚ β”‚ β”‚ β”‚
β”‚ ╰───────────────── resolution error: unresolved `type` `t`
β”‚ β”‚ β”‚ β”‚ β”‚
β”‚ ╰─────────────── resolution error: unresolved `type` `just`
β”‚ β”‚ β”‚ β”‚
β”‚ ╰─────────── parse error: unexpected token(s): #
β”‚ β”‚ β”‚
β”‚ ╰───────── resolution error: unresolved `type` `nothing`
β”‚ β”‚
β”‚ ╰── parse error: unexpected token(s): #
14 β”‚ just# value
β”‚ ┬───┬ ┬────
β”‚ ╰──────────── resolution error: unresolved `type` `just`
β”‚ β”‚ β”‚
β”‚ ╰──────── parse error: unexpected token(s): #
β”‚ β”‚
β”‚ ╰────── resolution error: unresolved `type` `value`
β”‚
16 β”‚ Nothing : Maybe a = Nothing @ |t just# nothing#|
β”‚ ┬──── ┬ ┬ ┬────── ┬ ┬┬ ┬───┬ ┬──────┬┬
β”‚ ╰─────────────────────────────────────── resolution error: unresolved `type` `Maybe`
β”‚ β”‚ β”‚ β”‚ β”‚ β”‚β”‚ β”‚ β”‚ β”‚ β”‚β”‚
β”‚ ╰───────────────────────────────── resolution error: unresolved `type` `a`
β”‚ β”‚ β”‚ β”‚ β”‚β”‚ β”‚ β”‚ β”‚ β”‚β”‚
β”‚ ╰─────────────────────────────── resolution error: unresolved `function` `=`
β”‚ β”‚ β”‚ β”‚β”‚ β”‚ β”‚ β”‚ β”‚β”‚
β”‚ ╰───────────────────────────── resolution error: unresolved `type` `Nothing`
β”‚ β”‚ β”‚β”‚ β”‚ β”‚ β”‚ β”‚β”‚
β”‚ ╰───────────────────── parse error: unexpected token(s): @
β”‚ β”‚β”‚ β”‚ β”‚ β”‚ β”‚β”‚
β”‚ ╰─────────────────── resolution error: unresolved `function` `|`
β”‚ β”‚ β”‚ β”‚ β”‚ β”‚β”‚
β”‚ ╰────────────────── resolution error: unresolved `type` `t`
β”‚ β”‚ β”‚ β”‚ β”‚β”‚
β”‚ ╰──────────────── resolution error: unresolved `type` `just`
β”‚ β”‚ β”‚ β”‚β”‚
β”‚ ╰──────────── parse error: unexpected token(s): #
β”‚ β”‚ β”‚β”‚
β”‚ ╰────────── resolution error: unresolved `type` `nothing`
β”‚ β”‚β”‚
β”‚ ╰─── parse error: unexpected token(s): #
β”‚ β”‚
β”‚ ╰── resolution error: unresolved `function` `|`
17 β”‚ nothing#
β”‚ ┬──────┬
β”‚ ╰───────── resolution error: unresolved `type` `nothing`
β”‚ β”‚
β”‚ ╰── parse error: unexpected token(s): #
β”‚
19 β”‚ Maybe.unwrap (maybe : Maybe a) : a =
β”‚ ┬──── ┬ ┬ ┬
β”‚ ╰─────────────── resolution error: unresolved `type` `Maybe`
β”‚ β”‚ β”‚ β”‚
β”‚ ╰───────── resolution error: unresolved `type` `a`
β”‚ β”‚ β”‚
β”‚ ╰──── resolution error: unresolved `type` `a`
β”‚ β”‚
β”‚ ╰── resolution error: unresolved `function` `=`
20 β”‚ maybe // match maybe with
β”‚ ┬──── β”‚
β”‚ ╰─────────────────────────── resolution error: unresolved `type` `maybe`
β”‚ β”‚
β”‚ ╰─ parse error: (missing simple_identifier)
21 β”‚ (|value| value) // Just a => a
β”‚ β”‚ ┬──── ┬────
β”‚ ╰─────────────────── parse error: (missing simple_identifier)
β”‚ β”‚ β”‚
β”‚ ╰───────────── resolution error: unresolved `type` `value`
β”‚ β”‚
β”‚ ╰────── resolution error: unresolved `type` `value`
────╯
34 changes: 7 additions & 27 deletions sol-driver/tests/mod.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
// use sol_diagnostic::Diagnostics;
// use sol_driver::{make_test_suite, suite::*};
// use sol_eval::{hir_eval, stack::Stack};
// use sol_hir_lowering::hir_lower;
// use sol_syntax::parse;
// use sol_tt::Env;
// use sol_typer::table::infer_type_table;
// use sol_vfs::SourceFile;
// use utils::create_package;
use sol_diagnostic::Diagnostics;
use sol_driver::{make_test_suite, suite::*};
use sol_hir_lowering::hir_lower;
use sol_syntax::parse;
use sol_typer::table::infer_type_table;
use sol_vfs::SourceFile;
use utils::create_package;

pub mod utils;

Expand Down Expand Up @@ -37,21 +35,3 @@ make_test_suite! {
Ok(())
}
}

// make_test_suite! {
// tests ("evaluation") {
// eval "eval"
// }
// run |db, source, output| {
// let file = SourceFile::new(&db, "repl".into(), "Repl".into(), source);

// let src = parse(&db, file);
// let local = create_package(&db, src, "local");
// let hir = hir_lower(&db, local, src);
// let value = hir_eval(&db, Stack::default(), Env::default(), hir);

// writeln!(output, "{:#?}", value)?;

// Ok(())
// }
// }

0 comments on commit 19fff4a

Please sign in to comment.