moonbit-docs icon indicating copy to clipboard operation
moonbit-docs copied to clipboard

confused error message for struct initialize

Open HerrCai0907 opened this issue 1 year ago • 1 comments

Parser cannot understand incorrect usage between = and : when initializing struct.

The second error message in example miss the possibility of :.

[4021] Error: The value identifier current is unbound.
   │
 8 │   let engine : SfcEngine = { seed, init_circle, current=0 }
   │                                                 ───┬───  
   │                                                    ╰───── The value identifier current is unbound.
───╯
[3002] Error: Parse error, unexpected token `=`, you may expect `,` or `}`.
   │
 8 │   let engine : SfcEngine = { seed, init_circle, current=0 }
   │                                                        ┬  
   │                                                        ╰── Parse error, unexpected token `=`, you may expect `,` or `}`.
───╯
error: failed when building

HerrCai0907 avatar Aug 10 '24 08:08 HerrCai0907

Thanks for your feedback, we will improve the error message for this case.

Yoorkin avatar Aug 13 '24 02:08 Yoorkin

fixed

Yoorkin avatar Dec 17 '24 08:12 Yoorkin