修复格式化结构体匿名嵌入成员在类型前打印冒号的问题

This commit is contained in:
chai2010
2025-01-02 21:08:13 +08:00
parent 9023cfabe3
commit 20da7dbdee
2 changed files with 17 additions and 1 deletions

View File

@@ -18,3 +18,18 @@ func ExampleFormatCode() {
// Output:
// func add(a: i32, b: i32) => i32 { return a + b }
}
func ExampleFormatCode_structEmbeddingField() {
s, err := api.FormatCode("hello.wa", `
type A :struct{ }
type B :struct{ A }
`)
if err != nil {
panic(err)
}
fmt.Println(s)
// Output:
// type A :struct{}
// type B :struct{ A }
}