fix: infinite loop in simplifying recursive functions (#246)

* fix: infinite loop in simplifying recursive functions

* dev: update snapshot
This commit is contained in:
Myriad-Dreamin 2024-05-07 13:39:04 +08:00 committed by GitHub
parent 25ae4afcbb
commit b0c71a0961
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 23 additions and 4 deletions

View file

@ -1457,10 +1457,13 @@ impl<'a, 'b> TypeSimplifier<'a, 'b> {
match &w.kind {
FlowVarKind::Weak(w) => {
let w = w.read();
if pol {
self.positives.insert(v.0);
let inserted = if pol {
self.positives.insert(v.0)
} else {
self.negatives.insert(v.0);
self.negatives.insert(v.0)
};
if !inserted {
return;
}
if pol {

View file

@ -0,0 +1,5 @@
// path: base.typ
#let a(x) = a;
-----
#import "base.typ": *
#let f() = a()

View file

@ -0,0 +1,11 @@
---
source: crates/tinymist-query/src/analysis.rs
expression: result
input_file: crates/tinymist-query/src/fixtures/type_check/recursive.typ
---
"a" = Any
"f" = () -> Any
---
27..28 -> @f
33..34 -> (@a | (Any) -> Any)
33..36 -> Any