Skip to content

Commit c0784c9

Browse files
authored
Merge pull request #459 from Kmeakin/pretty-metavars
Distill metavariables to named terms
2 parents 578f046 + 26d8a52 commit c0784c9

14 files changed

+31
-13
lines changed

fathom/src/surface/distillation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ impl<'interner, 'arena, 'env> Context<'interner, 'arena, 'env> {
8585
fn get_hole_name(&self, var: Level) -> Option<StringId> {
8686
match self.meta_sources.get_level(var)? {
8787
MetaSource::HoleExpr(_, name) => Some(*name),
88-
_ => None,
88+
_ => Some(self.interner.borrow_mut().get_or_intern(var.to_string())),
8989
}
9090
}
9191

fathom/tests/source_tests.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ impl TestMode {
3939
#[serde(deny_unknown_fields)]
4040
#[serde(rename_all = "kebab-case")]
4141
struct Config {
42+
#[serde(default = "DEFAULT_ALLOW_ERRORS")]
43+
allow_errors: bool,
4244
mode: Option<TestMode>,
4345
#[serde(default = "DEFAULT_IGNORE")]
4446
ignore: bool,
@@ -54,6 +56,7 @@ struct Config {
5456
test_normalisation: bool,
5557
}
5658

59+
const DEFAULT_ALLOW_ERRORS: fn() -> bool = || false;
5760
const DEFAULT_IGNORE: fn() -> bool = || false;
5861
const DEFAULT_EXIT_CODE: fn() -> i32 = || 0;
5962
const DEFAULT_EXAMPLE_DATA: fn() -> Vec<String> = Vec::new;
@@ -296,6 +299,9 @@ impl<'a> TestCommand<'a> {
296299
let mut failures = Vec::new();
297300
let mut command = process::Command::from(self.command);
298301
command.arg(self.input_file);
302+
if self.config.allow_errors {
303+
command.arg("--allow-errors");
304+
}
299305

300306
match command.output() {
301307
Ok(output) => {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
//~ exit-code = 1
1+
//~ allow-errors = true
22

33
fun a => a

tests/fail/elaboration/unsolved/fun-literal-param-type.snap

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
stdout = ''
1+
stdout = '''
2+
fun a => a : ?0 -> ?0
3+
'''
24
stderr = '''
35
error: failed to infer named pattern type
46
┌─ tests/fail/elaboration/unsolved/fun-literal-param-type.fathom:3:5
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
//~ exit-code = 1
1+
//~ allow-errors = true
22

33
fun (A : Type) a (b : A) => a : fun (A : Type) -> _

tests/fail/elaboration/unsolved/fun-literal-placeholder-body-type.snap

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
stdout = ''
1+
stdout = '''
2+
fun A a b => a : fun (A : Type) -> ?2 A -> A -> ?2 A
3+
'''
24
stderr = '''
35
error: failed to infer named pattern type
46
┌─ tests/fail/elaboration/unsolved/fun-literal-placeholder-body-type.fathom:3:16
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
//~ exit-code = 1
1+
//~ allow-errors = true
22

33
?woopsie : Type

tests/fail/elaboration/unsolved/hole-ann.snap

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
stdout = ''
1+
stdout = '''
2+
?woopsie : Type
3+
'''
24
stderr = '''
35
error: failed to infer hole expression
46
┌─ tests/fail/elaboration/unsolved/hole-ann.fathom:3:1
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
//~ exit-code = 1
1+
//~ allow-errors = true
22

33
?woopsie

tests/fail/elaboration/unsolved/hole.snap

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
stdout = ''
1+
stdout = '''
2+
?woopsie : ?0
3+
'''
24
stderr = '''
35
error: failed to infer hole expression
46
┌─ tests/fail/elaboration/unsolved/hole.fathom:3:1

0 commit comments

Comments
 (0)