Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ typr-cli.workspace = true
typr-core.workspace = true

[workspace.package]
version = "0.4.19"
version = "0.4.25"
edition = "2021"
authors = ["Fabrice Hategekimana <fab.hatege15@gmail.com>"]
license = "Apache-2.0"
Expand Down Expand Up @@ -58,9 +58,9 @@ syntect = "5.3.0"
bincode = "1.3"
extendr-api = "0.8.1"

typr-core = { path = "crates/typr-core" }
typr-cli = { path = "crates/typr-cli" }
typr-wasm = { path = "crates/typr-wasm" }
typr-core = { path = "crates/typr-core", version = "0.4" }
typr-cli = { path = "crates/typr-cli", version = "0.4" }
typr-wasm = { path = "crates/typr-wasm", version = "0.4" }

[profile.release]
opt-level = 3
Expand Down
2 changes: 1 addition & 1 deletion configs/src/data.toml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
release_version = 19
release_version = 25
2 changes: 1 addition & 1 deletion crates/typr-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "typr-core"
description = "Core type checking and transpilation logic for TypR - a typed superset of R"
keywords = ["R", "type-checker", "language", "transpiler", "wasm"]
readme = "README.md"
readme = "../../README.md"
version.workspace = true
edition.workspace = true
authors.workspace = true
Expand Down
24 changes: 0 additions & 24 deletions crates/typr-core/src/components/type/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1241,13 +1241,6 @@ mod tests {
use crate::processes::type_checking::typing;
use crate::utils::fluent_parser::FluentParser;

#[test]
fn test_record_hierarchy0() {
let name = builder::record_type(&[("name".to_string(), builder::character_type_default())]);
let age = builder::record_type(&[("age".to_string(), builder::integer_type_default())]);
assert!(name.is_subtype(&age, &Context::default()).0);
}

#[test]
fn test_record_hierarchy1() {
let p1 = builder::record_type(&[
Expand Down Expand Up @@ -1277,23 +1270,6 @@ mod tests {
assert_eq!(t1.is_subtype(&t1, &Context::default()).0, true);
}

#[test]
fn test_tuple_subtyping2() {
let typ1 = "{int, int}".parse::<Type>().unwrap();
let typ2 = "{T, T}".parse::<Type>().unwrap();
assert!(typ1 < typ2)
}

#[test]
fn test_sequence_subtyping1() {
let s1 = "Seq[0, Empty]".parse::<Type>().unwrap();
let s2 = "Seq[0, int]".parse::<Type>().unwrap();
assert!(
s1.is_subtype(&s2, &Context::default()).0,
"An Empty sequence should be subtype of an empty sequence of a defined type."
);
}

#[test]
fn test_interface_and_type_subtyping1() {
let self_fn_type = builder::function_type(
Expand Down
25 changes: 0 additions & 25 deletions crates/typr-core/src/processes/parsing/elements.rs
Original file line number Diff line number Diff line change
Expand Up @@ -861,18 +861,6 @@ mod tests {
let _ = "{ }".parse::<Lang>();
}

#[test]
#[should_panic]
fn test_function_with_empty_scope1() {
let _ = "fn(): int {}".parse::<Lang>();
}

#[test]
#[should_panic]
fn test_function_with_empty_scope2() {
let _ = simple_function("fn(): int {}".into());
}

#[test]
fn test_function_with_empty_scope3() {
let res = simple_function("fn(): int { 5 }".into()).unwrap().1;
Expand All @@ -891,12 +879,6 @@ mod tests {
assert_eq!(res, "hello", "Should return the variable name 'hello'");
}

#[test]
fn test_simple_variable2() {
let res = variable_exp("module::hello".into()).unwrap().1 .0;
assert_eq!(res, "hello", "Should return the variable name 'hello'");
}

#[test]
fn test_addition1() {
let res = "1 + 2".parse::<Lang>().unwrap();
Expand Down Expand Up @@ -976,13 +958,6 @@ mod tests {
assert!(true);
}

#[test]
fn test_function_application1() {
let res = elements("hey . add()".into()).unwrap().1;
dbg!(&res);
assert!(true);
}

#[test]
fn test_quoted_variable() {
let res = quoted_variable("`+`".into()).unwrap().1;
Expand Down
28 changes: 0 additions & 28 deletions crates/typr-core/src/processes/parsing/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -957,14 +957,6 @@ mod tesus {
}
}

#[test]
fn test_type_exp2() {
let res = type_exp("type Mat<M, N, T> = [M, [N, T]];".into())
.unwrap()
.0;
assert_eq!(res, "alias(var('Mat'), [M, N, T], [M, [N, T]])".into());
}

#[test]
fn test_assign1() {
let res = assign("a <- 12;".into()).unwrap().1;
Expand All @@ -974,24 +966,4 @@ mod tesus {
"The expression 'a <- 12;' should be identified as an assignation"
);
}

#[test]
fn test_assign2() {
let res = assign("a.b() <- 12;".into()).unwrap().1;
assert_eq!(
"Assign",
res[0].simple_print(),
"The expression 'a.b() <- 12;' should be identified as an assignation"
);
}

#[test]
fn test_assign3() {
let res = assign("a$b <- 12;".into()).unwrap().1;
assert_eq!(
"Assign",
res[0].simple_print(),
"The expression 'a$b <- 12;' should be identified as an assignation"
);
}
}
83 changes: 0 additions & 83 deletions crates/typr-core/src/processes/parsing/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -587,84 +587,13 @@ mod tests {
use crate::components::r#type::type_system::TypeSystem;
use crate::utils::builder;

#[test]
fn test_alias_type1() {
//Test if alias can be parsed
let res = ltype("Option<T>".into()).unwrap().1;
assert_eq!(
res.to_category(),
TypeCategory::Alias,
"Parsing 'Option<T>' should give an Alias type"
);
}

#[test]
fn test_alias_type2() {
//Test if alias can be reduced
let record_type = builder::record_type(&[("content".to_string(), builder::generic_type())]);
let context = Context::default().set_new_aliase_signature("Triplet<T>", record_type);
let type_ = ltype("Triplet<int>".into()).unwrap().1;
let reduced_type = type_.reduce(&context);
assert_eq!(reduced_type.pretty(), "{content: int}");
}

#[test]
fn test_alias_type3() {
//Test if alias can be parsed
let res = ltype("Model".into()).unwrap().1;
assert_eq!(
res.to_category(),
TypeCategory::Alias,
"Parsing 'Model' should give an Alias type"
);
}

#[test]
fn test_variable_type1() {
let var = ltype("my_var".into()).unwrap().1;
assert_eq!(
var,
Type::Variable("my_var".to_string(), HelpData::default())
);
}

#[test]
fn test_fabrice0() {
let arr1 = ltype("[1, T]".into()).unwrap().1;
let arr2 = ltype("[1, 1]".into()).unwrap().1;
assert_eq!(arr2.is_subtype(&arr1, &Context::default()).0, true);
}

#[test]
fn test_intersection_parsing() {
let res = "int & char & bool".parse::<Type>().unwrap();
assert_eq!(
res.pretty(),
"(& (& int char) bool)".to_string(),
"Parsing 'int & char & bool' should give an intersection"
);
}

#[test]
fn test_union_parsing() {
let res = "int | char | bool".parse::<Type>().unwrap();
assert_eq!(
res.pretty(),
"(| (| int char) bool)".to_string(),
"Parsing 'int & char & bool' should give an intersection"
);
}

#[test]
fn test_union_intersection_parsing() {
let res = "int | char & bool".parse::<Type>().unwrap();
assert_eq!(
res.pretty(),
"(& (| int char) bool)".to_string(),
"Parsing 'int & char & bool' should give an intersection"
);
}

#[test]
fn test_interface_parsing1() {
let res = interface("interface { hey: (num, num) -> num }".into())
Expand Down Expand Up @@ -725,18 +654,6 @@ mod tests {
assert_eq!(typ.pretty(), "fn() -> Empty".to_string());
}

#[test]
fn test_function_signature2() {
let typ = ltype("(bool) -> Empty".into()).unwrap().1;
assert_eq!(typ.pretty(), "fn(bool) -> Empty".to_string());
}

#[test]
fn test_function_signature3() {
let typ = function_type("(bool) -> Empty".into()).unwrap().1;
assert_eq!(typ.pretty(), "fn(bool) -> Empty".to_string());
}

#[test]
fn test_char_litteral1() {
let typ = char_litteral("'hello'".into()).unwrap().1;
Expand Down
14 changes: 0 additions & 14 deletions crates/typr-core/src/processes/parsing/vector_priority.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,18 +144,4 @@ mod tests {
println!("{}", PriorityTokens::<TypeToken, Type>::display_state(&res));
assert!(true)
}

#[test]
fn test_priority1() {
let vec: Vec<TypeToken> = vec![];
let res = VectorPriority::from(vec);
assert_eq!(PriorityTokens::<TypeToken, Type>::len(&res), 0_usize);
}

#[test]
fn test_priority2() {
let vec: Vec<TypeToken> = vec![];
let res = VectorPriority::from(vec);
assert_eq!(PriorityTokens::<TypeToken, Type>::peak_first(&res), None);
}
}
15 changes: 0 additions & 15 deletions crates/typr-core/src/processes/transpiling/translatable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,18 +139,3 @@ impl RTranslatable<(String, Context)> for Box<Lang> {
(**self).to_r(context)
}
}

#[cfg(test)]
mod tests {
use super::*;
use crate::components::error_message::help_data::HelpData;

#[test]
fn test_simple_trans0() {
let t = Translatable::from(Context::default());
let bo = Lang::Bool(true, HelpData::default());
let v = vec![bo.clone(), bo.clone(), bo];
let (a, _) = t.join(&v, ", ").into();
assert_eq!(a, "true");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -135,17 +135,6 @@ mod tests {
assert_eq!(res, fun_typ);
}

#[test]
fn test_vectorization1() {
let res = FluentParser::new()
.push("@f2: (int, int) -> int;")
.run()
.check_typing("f2(3, [1, 2])");
let fun_typ =
builder::array_type(builder::integer_type(2), builder::integer_type_default());
assert_eq!(res, fun_typ);
}

#[test]
fn test_litteral_char_type1() {
let res = FluentParser::new()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,6 @@ mod tests {
assert_eq!(res, &Lang::Signature(var, integer, HelpData::default()));
}

#[test]
fn test_signature_expression_is_type_checking() {
let res = FluentParser::new().check_typing("@a: int;");
let integer = builder::integer_type_default();
assert_eq!(res, integer);
}

#[test]
fn test_signature_expression_is_transpiling() {
let res = FluentParser::new().check_transpiling("@a: int;");
Expand Down Expand Up @@ -126,14 +119,4 @@ mod tests {
let boolean = builder::boolean_type();
assert_eq!(res, boolean)
}

#[test]
fn test_signature_vectorized_function_application1() {
let res = FluentParser::new()
.push("@f: (int) -> bool;")
.run()
.check_typing("f([1, 2, 3])");
let boolean = builder::boolean_type();
assert_eq!(res, boolean)
}
}
Loading
Loading