Using `rescript format` on the following code yields syntactically incorrect result: ```rescript // compiles successfully module type T = { let f: string => string } let g = (x: string) => { module M: T = { let f = s => s ++ s } x->M.f } ``` will be formatted to: ```rescript // compilation fails with syntax error module type T = { let f: string => string } let g = (x: string) => { module M = { let f = s => s ++ s }: T // <-- Note the type annotation was moved here~ x->M.f } ``` Afaik this issue is present in all versions of rescript (9.* & 10.*). Repro available as a repository at https://github.com/woeps/rescript-formatting-issue-repro or at the [playground.](https://rescript-lang.org/try?version=v10.1.2&code=LYewJgrgNgpgBAFwJ4Ad4BU4F44G8BQccsCcAZgFxwDOCATgJYB2A5tgHw33Mv4C++fCThscACgAeVWo1YBKDnkJxQkWHACyVTDgJEiwsthqLqcANTmaygUQkBadhoB0ZfoID0HuOgAW8AEMAIxAAN3gAdwYoKDgg+DEAiAQQewUyEDpgAIQEGDB8LyIUxH9yEBiQKNY4MQjfBgBjXzgGMyYQUlCAqAYwGiQmBACJOQpC72FRWqkuWRYFLE4CIqJVaHgNYxXvfWIYUiMcMyWTS2tVuD5tCf0HJ1dbgSA). While I understand this is not ideal code in most cases, I believe formatting should always yield a syntactically correct result. --- Note: If the module (with type signature) is not inside a function, formatting works as expected: ```res // compiles successfully and won't be reformatted module type T = { let f: string => string } module M: T = { let f = s => s ++ s } ``` [above example at the Playground](https://rescript-lang.org/try?version=v10.1.2&code=LYewJgrgNgpgBAFwJ4Ad4BU4F44G8BQccsCcAZgFxwDOCATgJYB2A5tgHw33Mv4C++fKEiw4AWSqYcBIiXLYaHRQGplNfviA)