E3800#

Expecting a newline or ; here, but encountered another delimiter.

enum 定義のコンストラクタ、struct 定義のフィールド、suberror 定義のコンストラクタは、改行または ; で区切る必要があります。AI が誤った区切り文字 , を含むコードを生成することが多いため、ユーザーと AI が修正しやすいよう、このエラーを個別に検出します。

Erroneous example#

///|
enum V {
  // Error: Expecting a newline or `;` here, but encountered `,`.
  A,
}

///|
struct S {
  // Error: Expecting a newline or `;` here, but encountered `,`.
  a : Int,
}

///|
suberror E {
  // Error: Expecting a newline or `;` here, but encountered `,`.
  A,
}

Suggestion#

Replace , with a newline or ; as appropriate. We suggest using a newline since it conforms to the MoonBit style suggested by the MoonBit formatter.

///|
enum V {
  A
}

///|
struct S {
  a : Int
}

///|
suberror E {
  A
}