Skip to content

Commit 1df4b0f

Browse files
committed
create a main function
1 parent 6ae9ccd commit 1df4b0f

File tree

7 files changed

+24
-99
lines changed

7 files changed

+24
-99
lines changed

Cargo.lock

Lines changed: 2 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ rustc_private=true
1212
pretty_assertions = "1.3.0"
1313

1414
[dependencies]
15+
anyhow = "1"
1516
clap = { version = "4.0.9", features = ["derive"] }
1617
formality-rust = { version = "0.1.0", path = "crates/formality-rust" }
1718
formality-types = { version = "0.1.0", path = "crates/formality-types" }
18-
formality-core = { version = "0.1.0", path = "crates/formality-core" }
19+
formality-check = { version = "0.1.0", path = "crates/formality-check" }
1920

2021
[workspace]
2122
members = [
@@ -24,6 +25,5 @@ members = [
2425
"crates/formality-types",
2526
"crates/formality-check",
2627
"crates/formality-rust",
27-
"crates/formality-main",
2828
"crates/formality-prove",
2929
]

crates/formality-main/Cargo.toml

Lines changed: 0 additions & 12 deletions
This file was deleted.

crates/formality-main/src/bin.rs

Lines changed: 0 additions & 1 deletion
This file was deleted.

crates/formality-main/src/main.rs

Lines changed: 0 additions & 38 deletions
This file was deleted.

crates/formality-prove/src/decls.rs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use formality_macros::term;
22
use formality_types::{
33
collections::Set,
4-
grammar::{AliasName, AliasTy, Binder, TraitId, TraitRef, Ty, TyData, Wc, Wcs},
4+
grammar::{AliasName, AliasTy, Binder, TraitId, TraitRef, Ty, Wc, Wcs},
55
};
66

77
#[term]
@@ -130,16 +130,6 @@ impl AliasEqDecl {
130130
pub fn alias_name(&self) -> AliasName {
131131
self.binder.peek().alias.name.clone()
132132
}
133-
134-
/// True if the target of this alias-eq declaration
135-
/// is a rigid type.
136-
pub fn target_is_rigid(&self) -> bool {
137-
if let TyData::RigidTy(_) = self.binder.peek().ty.data() {
138-
true
139-
} else {
140-
false
141-
}
142-
}
143133
}
144134

145135
#[term($alias = $ty where $where_clause)]

src/main.rs

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,25 @@
1-
// use formality_types::grammar::Fallible;
1+
use clap::Parser;
2+
use formality_check::check_all_crates;
3+
use formality_rust::grammar::Program;
4+
use formality_types::parse::term;
25

3-
// use clap::Parser;
6+
#[derive(Parser, Debug)]
7+
#[command(author, version, about, long_about = None)]
8+
struct Args {
9+
#[arg(long)]
10+
print_rust: bool,
411

5-
// /// Formality test generator: convert Rust programs into redex tests
6-
// #[derive(Parser, Debug)]
7-
// #[command(author, version, about, long_about = None)]
8-
// struct Args {
9-
// /// If set, print the racket program to stdout and quit.
10-
// /// Otherwise, we will invoke racket.
11-
// #[arg(long)]
12-
// print: bool,
13-
14-
// /// If set, generate a test that expects the program not to compile.
15-
// #[arg(long)]
16-
// fail: bool,
12+
input_path: String,
13+
}
1714

18-
// input_path: String,
19-
// }
15+
fn main() -> anyhow::Result<()> {
16+
let args = Args::parse();
17+
let input: String = std::fs::read_to_string(&args.input_path)?;
18+
let program: Program = term(&input);
2019

21-
// fn main() -> Fallible<()> {
22-
// let args = Args::parse();
23-
// let input = std::fs::read_to_string(&args.input_path)?;
24-
// formality_rust::test_program_ok(&input)?;
25-
// Ok(())
26-
// }
20+
if args.print_rust {
21+
eprintln!("{:#?}", program);
22+
}
2723

28-
fn main() {
29-
println!("FIXME");
24+
check_all_crates(&program)
3025
}

0 commit comments

Comments
 (0)