fix: determine name_started in sig constructors (#1038)

* fix: name_started in sig constructors

* fix: test it
This commit is contained in:
Myriad-Dreamin 2024-12-21 13:50:37 +08:00 committed by GitHub
parent 97541d54f8
commit a4de68a1ca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 12 additions and 11 deletions

View file

@ -1,8 +1,8 @@
---
source: crates/tinymist-query/src/analysis.rs
description: "Check on \"(\" (30)"
expression: literal_type
expression: post_ty
input_file: crates/tinymist-query/src/fixtures/post_type_check/text_font2.typ
snapshot_kind: text
---
TextFont
( ⪰ "Test" ⪯ TextFont)

View file

@ -1,8 +1,8 @@
---
source: crates/tinymist-query/src/analysis.rs
description: "Check on \"(\" (31)"
expression: literal_type
expression: post_ty
input_file: crates/tinymist-query/src/fixtures/post_type_check/text_font4.typ
snapshot_kind: text
---
TextFont
( ⪰ "Test" ⪯ TextFont)

View file

@ -1,8 +1,8 @@
---
source: crates/tinymist-query/src/analysis.rs
description: "Check on \"\\\"Test\\\"\" (31)"
expression: literal_type
expression: post_ty
input_file: crates/tinymist-query/src/fixtures/post_type_check/text_font_element4.typ
snapshot_kind: text
---
TextFont
( ⪰ "Test" ⪯ TextFont)

View file

@ -1,8 +1,8 @@
---
source: crates/tinymist-query/src/analysis.rs
description: "Check on \"(\" (105)"
expression: literal_type
expression: post_ty
input_file: crates/tinymist-query/src/fixtures/post_type_check/user_func.typ
snapshot_kind: text
---
TextFont
( ⪰ TextFont ⪯ "Test")

View file

@ -7,7 +7,7 @@ snapshot_kind: text
"a" = (1, )
"f" = ((Type(bytes) | Type(decimal) | Type(float) | Type(int) | Type(label) | Type(str) | Type(type) | Type(version))) => Type(str)
"" = ((Type(bytes) | Type(decimal) | Type(float) | Type(int) | Type(label) | Type(str) | Type(type) | Type(version))) => Type(str)
"x" = Any
"x" = Type(int)
"b" = (Type(str), )
=====
5..6 -> @a

View file

@ -777,7 +777,7 @@ impl SigTy {
inputs: Interned::new(vec![inp]),
body: Some(ret),
names: NameBone::empty(),
name_started: 0,
name_started: 1,
spread_left: false,
spread_right: false,
})
@ -791,11 +791,12 @@ impl SigTy {
} else {
Ty::Tuple(elems.clone())
};
let name_started = elems.len() as u32;
Interned::new(Self {
inputs: elems,
body: Some(ret),
names: NameBone::empty(),
name_started: 0,
name_started,
spread_left: false,
spread_right: false,
})