mirror of
https://github.com/Myriad-Dreamin/tinymist.git
synced 2025-08-02 09:22:17 +00:00
parent
04dd06313a
commit
8cbd32c724
3 changed files with 16 additions and 2 deletions
|
@ -63,7 +63,7 @@ mod type_check_tests {
|
||||||
.map(|e| (e.1.name(), e.1))
|
.map(|e| (e.1.name(), e.1))
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
vars.sort_by(|x, y| x.0.cmp(&y.0));
|
vars.sort_by(|x, y| x.1.var.cmp(&y.1.var));
|
||||||
|
|
||||||
for (name, var) in vars {
|
for (name, var) in vars {
|
||||||
writeln!(f, "{:?} = {:?}", name, info.simplify(var.as_type(), true))?;
|
writeln!(f, "{:?} = {:?}", name, info.simplify(var.as_type(), true))?;
|
||||||
|
|
|
@ -6,8 +6,8 @@ input_file: crates/tinymist-query/src/fixtures/type_check/confusing-name.typ
|
||||||
"date" = Any
|
"date" = Any
|
||||||
"info" = Any
|
"info" = Any
|
||||||
"master-cover" = (Any, "x": Any) => TypeBinary { operands: (Any, TypeBinary { operands: ({"submit-date": 0}, Any), op: Add }), op: Assign }
|
"master-cover" = (Any, "x": Any) => TypeBinary { operands: (Any, TypeBinary { operands: ({"submit-date": 0}, Any), op: Add }), op: Assign }
|
||||||
"x" = Any
|
|
||||||
"x" = (Any) => Any
|
"x" = (Any) => Any
|
||||||
|
"x" = Any
|
||||||
---
|
---
|
||||||
5..6 -> @x
|
5..6 -> @x
|
||||||
7..11 -> @date
|
7..11 -> @date
|
||||||
|
|
|
@ -264,6 +264,20 @@ pub struct TypeVar {
|
||||||
pub syntax: Option<Interned<TypeSource>>,
|
pub syntax: Option<Interned<TypeSource>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Ord for TypeVar {
|
||||||
|
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
|
||||||
|
self.name
|
||||||
|
.cmp(&other.name)
|
||||||
|
.then_with(|| self.def.0.cmp(&other.def.0))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl PartialOrd for TypeVar {
|
||||||
|
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
|
||||||
|
Some(self.cmp(other))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl fmt::Debug for TypeVar {
|
impl fmt::Debug for TypeVar {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
write!(f, "@{}", self.name)
|
write!(f, "@{}", self.name)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue