Skip to content

Commit

Permalink
[ #7 ] Negative examples
Browse files Browse the repository at this point in the history
  • Loading branch information
ice1000 committed Mar 16, 2019
1 parent 42fe01e commit 2248ae6
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
7 changes: 7 additions & 0 deletions samples/negative/girard-paradox.minitt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
--
-- Created by intellij-minitt on 2019-03-16
-- girard-paradox
-- Author: ice1000
--

let error: Type = Type;
5 changes: 5 additions & 0 deletions samples/negative/girard-paradox.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Parse successful.
Type mismatch: expected `Type0`, got (inferred): `Type1`.
When checking the declaration of `error`.
thread 'main' panicked at 'Type-Check failed.: ()', src/libcore/result.rs:997:5
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
2 changes: 1 addition & 1 deletion samples/test.pl
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
map {say red(" $_")} split /\n/, $diff;
next if $isCI;
print colored(' Update the golden value (y/N)? ', 'cyan');
(readline =~ s/[\n\r]//rg) eq 'y' ? `$cmd > $out`
(readline =~ s/[\n\r]//rg) eq 'y' ? `$cmd > $out 2>&1`
: say colored(<<"HINT", 'bold yellow');
Leaving it alone.
To update the golden value, run `test_runner.pl` in `src/test` directly.
Expand Down
3 changes: 3 additions & 0 deletions src/check/decl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ pub fn check_lift_parameters<'a>(
return check_body(tcs);
}
let (pattern, expression) = parameters.remove(0);
// TODO: this level might be the pi level
let (_level, TCS { gamma, context }) = check_type(index, tcs, *expression.clone())?;
let generated = generate_value(index);
let type_val = expression.clone().eval(context.clone());
Expand Down Expand Up @@ -130,6 +131,7 @@ pub fn check_declaration(index: u32, tcs: TCS, declaration: Declaration) -> TCM<
body,
declaration_type: Simple,
} => check_lift_parameters(index, tcs_borrow!(tcs), prefix_parameters, |tcs| {
// TODO: this level might be the pi level
let (_level, tcs) = check_type(index, tcs, signature.clone())
.map_err(|err| try_locate!(err, pattern))?;
let context = tcs.context();
Expand All @@ -145,6 +147,7 @@ pub fn check_declaration(index: u32, tcs: TCS, declaration: Declaration) -> TCM<
tcs_borrow!(tcs),
declaration.prefix_parameters.clone(),
|tcs| {
// TODO: this level might be the pi level
let (_level, TCS { gamma, context }) =
check_type(index, tcs, declaration.signature.clone())
.map_err(|err| try_locate!(err, pattern))?;
Expand Down

0 comments on commit 2248ae6

Please sign in to comment.