formatting

This commit is contained in:
pca006132 2020-12-28 16:00:02 +08:00 committed by pca006132
parent 75183c39fd
commit 0200ea1458

View File

@ -233,13 +233,7 @@ mod tests {
);
assert_eq!(
resolve_call(
&ctx,
None,
"float",
create_tuple(vec![]),
&mut assumptions
),
resolve_call(&ctx, None, "float", create_tuple(vec![]), &mut assumptions),
Err("different parametric types".to_string())
);
@ -493,14 +487,20 @@ mod tests {
let list = ctx.get_parametric_mut(LIST_TYPE);
let t = Rc::new(TypeVariable(list.params[0]));
list.base.methods.insert("head", FnDef {
list.base.methods.insert(
"head",
FnDef {
args: create_tuple(vec![]),
result: Some(t.clone())
});
list.base.methods.insert("append", FnDef {
result: Some(t.clone()),
},
);
list.base.methods.insert(
"append",
FnDef {
args: create_tuple(vec![t.clone()]),
result: None
});
result: None,
},
);
let v0 = Rc::new(TypeVariable(ctx.add_variable(VarDef {
name: "V0",
@ -541,7 +541,6 @@ mod tests {
),
Err("different variables".to_string())
);
}
#[test]
@ -553,46 +552,52 @@ mod tests {
base: TypeDef {
name: "Foo",
methods: HashMap::new(),
fields: HashMap::new()
fields: HashMap::new(),
},
parents: vec![]
parents: vec![],
});
let foo1 = ctx.add_class(ClassDef {
base: TypeDef {
name: "Foo1",
methods: HashMap::new(),
fields: HashMap::new()
fields: HashMap::new(),
},
parents: vec![foo]
parents: vec![foo],
});
let foo2 = ctx.add_class(ClassDef {
base: TypeDef {
name: "Foo2",
methods: HashMap::new(),
fields: HashMap::new()
fields: HashMap::new(),
},
parents: vec![foo1]
parents: vec![foo1],
});
let bar = ctx.add_class(ClassDef {
base: TypeDef {
name: "bar",
methods: HashMap::new(),
fields: HashMap::new()
fields: HashMap::new(),
},
parents: vec![]
parents: vec![],
});
ctx.add_fn("foo", FnDef {
ctx.add_fn(
"foo",
FnDef {
args: create_tuple(vec![VirtualClassType(foo).into()]),
result: None
});
ctx.add_fn("foo1", FnDef {
result: None,
},
);
ctx.add_fn(
"foo1",
FnDef {
args: create_tuple(vec![VirtualClassType(foo1).into()]),
result: None
});
result: None,
},
);
assert_eq!(
resolve_call(