Skip to content

Commit

Permalink
fix func return type and pipe
Browse files Browse the repository at this point in the history
  • Loading branch information
SkymanOne committed Apr 30, 2024
1 parent 994f477 commit acb33e2
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 8 deletions.
58 changes: 54 additions & 4 deletions crates/semantics/src/expression/complex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ pub fn resolve_func_call(
ExpectedType::Concrete(ty) => {
let mut error_return_ty = false;

if check_func_return_type(ty, func.return_ty.ty()) {
if !check_func_return_type(ty, func.return_ty.ty()) {
contract.diagnostics.push(Report::type_error(
loc.clone(),
String::from("Functional's return type mismatched the expected one."),
Expand Down Expand Up @@ -811,16 +811,66 @@ fn parse_args(
fn check_func_return_type(ty: &TypeVariant, return_ty: &TypeVariant) -> bool {
if let TypeVariant::List(l_ty) = return_ty {
match l_ty.as_ref() {
TypeVariant::Generic(allowed_tys) => allowed_tys.contains(ty),
TypeVariant::Generic(allowed_tys) => {
for at in allowed_tys {
if check_func_return_type(ty, at) {
return true;
}
}
false
}
a_ty => check_func_return_type(ty, a_ty),
}
} else if let TypeVariant::Set(l_ty) = return_ty {
match l_ty.as_ref() {
TypeVariant::Generic(allowed_tys) => allowed_tys.contains(ty),
TypeVariant::Generic(allowed_tys) => {
for at in allowed_tys {
if check_func_return_type(ty, at) {
return true;
}
}
false
}
a_ty => check_func_return_type(ty, a_ty),
}
} else if let TypeVariant::Generic(allowed_tys) = return_ty {
allowed_tys.contains(ty)
for at in allowed_tys {
if check_func_return_type(ty, at) {
return true;
}
}
false
} else if let TypeVariant::List(l_ty) = ty {
match l_ty.as_ref() {
TypeVariant::Generic(allowed_tys) => {
for at in allowed_tys {
if check_func_return_type(at, return_ty) {
return true;
}
}
false
}
a_ty => check_func_return_type(a_ty, return_ty),
}
} else if let TypeVariant::Set(l_ty) = ty {
match l_ty.as_ref() {
TypeVariant::Generic(allowed_tys) => {
for at in allowed_tys {
if check_func_return_type(at, return_ty) {
return true;
}
}
false
}
a_ty => check_func_return_type(a_ty, return_ty),
}
} else if let TypeVariant::Generic(allowed_tys) = ty {
for at in allowed_tys {
if check_func_return_type(at, return_ty) {
return true;
}
}
false
} else {
ty == return_ty
}
Expand Down
Binary file modified reports/main.pdf
Binary file not shown.
8 changes: 4 additions & 4 deletions reports/main.typ
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
name: "Dr. Indu Bodala",
email: "[email protected]"
),
date: "April 20, 2024",
date: "April 29, 2024",
program: "BSc Computer Science",
is_progress_report: false,
abstract_text: abstract,
Expand Down Expand Up @@ -1272,7 +1272,7 @@ An example of a failed formal verification report is shown in @Figure:ariadne.
) <Figure:ariadne>

#pagebreak()
= Testing strategies
= Testing Strategies

During the development test-driven development and extreme programming techniques were applied. Each crate was extensively tested using unit tests. An output is displayed in @Listing:TestCases.

Expand Down Expand Up @@ -1373,7 +1373,7 @@ Project development did not see any major deviation from the original plan. This

However, the development of the semantics crate took slightly more time than expected due to the realisation of the importance of the functional correctness of the crate in the scope of other crates. Therefore, more time was dedicated to testing and development which shifted the deadline for the rest of the planned work. @Appendix:ActualGannt illustrates the actual time it took to complete the project and the updated objectives.

= Final words
= Final Words

This paper's goal was to prove that formal verification techniques can be integrated into the development and compilation process as first-class citizens. It addresses numerous problems associated with the security and safety of typical SCs and provides theoretical and practical proof of how they can be addressed at the language level.

Expand Down Expand Up @@ -1549,7 +1549,7 @@ Due to limited time, this project will only focus on a single-contract execution
caption: [`Cargo.toml` file]
)

= Emit example <Appendix:EmitExample>
= Emit Example <Appendix:EmitExample>

An example of a Folidty SC that represents counter application with some additional function to demonstrate other statements and expressions used and the compiled teal approval program.

Expand Down

0 comments on commit acb33e2

Please sign in to comment.