Skip to content

Commit

Permalink
Merge pull request #314 from gramlang/pi-type-checking
Browse files Browse the repository at this point in the history
Fix a bug in the type checking logic for pi types
  • Loading branch information
stepchowfun authored Apr 17, 2020
2 parents ddcc553 + 0e2ff21 commit 5dce53f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/type_checker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,6 @@ pub fn type_check_rec<'a>(
errors,
);

// Restore the context.
definitions_context.pop();
typing_context.pop();

// Check that the type of the codomain is the type of all types.
if !unify(&codomain_type, &type_term, definitions_context) {
errors.push(throw(
Expand All @@ -179,6 +175,10 @@ pub fn type_check_rec<'a>(
));
}

// Restore the context.
definitions_context.pop();
typing_context.pop();

// The type of a pi type is the type of all types.
type_term
}
Expand Down

0 comments on commit 5dce53f

Please sign in to comment.