Don't add call parens when an fn type is expected

This commit is contained in:
Jonas Schievink 2020-04-25 21:34:38 +02:00
parent 45832b990c
commit 76d6f54471
2 changed files with 63 additions and 0 deletions

View file

@ -1136,6 +1136,13 @@ impl Type {
matches!(&self.ty.value, Ty::Apply(ApplicationTy { ctor: TypeCtor::Closure { .. }, .. }))
}
pub fn is_fn(&self) -> bool {
matches!(&self.ty.value,
Ty::Apply(ApplicationTy { ctor: TypeCtor::FnDef(..), .. }) |
Ty::Apply(ApplicationTy { ctor: TypeCtor::FnPtr { .. }, .. })
)
}
pub fn contains_unknown(&self) -> bool {
return go(&self.ty.value);