Skip to content

エラーコードリファレンス

YaoXiang コンパイラはエラーコードを使用して различных типов の診断情報を識別します。エラーコードは番号範囲別にグループ化されており、各エラーコードは特定のエラーシナリオに対応しています。


E0xxx -- 字句解析と構文解析

字句解析器(Lexer)と構文解析器(Parser)段階で発生したエラー。

エラーコードテンプレート説明
E0001Invalid character: '{char}'無効な文字
E0002Invalid number literal: '{literal}'無効な数値リテラル
E0003Unterminated string starting at line {line}終了していない文字列
E0004Invalid character literal: '{literal}'無効な文字リテラル
E0010Expected {expected}, found {found}予期されたトークン
E0011Unexpected token: '{token}'予期しないトークン
E0012Invalid syntax: {reason}無効な構文
E0013Mismatched {bracket_type}: opened at line {open_line}, column {open_col}, not closed対応しない括弧
E0014Missing semicolon after {statement}セミコロン欠落

E1xxx -- 型チェック

型チェック段階で発生したエラー。変数型、関数呼び出し、パターンマッチング、ジェネリクスインスタンス化、並行処理セマンティクス、エラー伝播などを涵盖。

エラーコードテンプレート説明
E1001Unknown variable: '{name}'不明な変数
E1002Expected type '{expected}', found type '{found}'型が一致しない
E1003Unknown type: '{type}'不明な型
E1010Function '{func}' expects {expected} arguments, found {found}引数の数が一致しない
E1011Parameter type mismatch: expected '{expected}', found '{found}'引数型が一致しない
E1012Return type mismatch: expected '{expected}', found '{found}'戻り値型が一致しない
E1013Function not found: '{func}'関数が見つからない
E1020Cannot infer type for '{expr}'型を推論できない
E1021Type inference conflict: {reason}型推論の競合
E1030Pattern non-exhaustive: missing patterns {patterns}パターンが不完全
E1031Unreachable pattern: '{pattern}'到達不可能なパターン
E1040Operation '{op}' is not supported for type '{type}'操作がサポートされていない
E1041Index out of bounds: valid range is 0..{max}, found {index}インデックスが範囲外
E1042Field '{field}' not found in struct '{struct}'フィールドが見つからない
E1050Logical operation requires boolean operands, found '{left}' and '{right}'ブール型被演算子が必要
E1051Logical NOT requires boolean operand, found '{type}'論理NOTにはブール型被演算子が必要
E1052Cannot dereference type '{type}', expected pointer type無効なdereference
E1053Cannot access field on non-struct type '{type}'非構造体のフィールドアクセス
E1054Condition must be boolean, found '{type}'条件の型が一致しない
E1055Constraint type '{type}' can only be used in generic context制約が非ジェネリックコンテキストにある
E1060Expected {expected} type argument(s), found {found}型引数の数が一致しない
E1061Cannot instantiate generic type with given argumentsジェネリクスをインスタンス化できない
E1070Unknown label: '{label}'不明なラベル
E1081`?` is only allowed inside functions returning Result? はResult を返す関数内でのみ使用可能
E1082`?` requires a Result expression, found '{type}'? はResult 式のみに使用可能
E1083Result error type mismatch for `?`: expected '{expected}', found '{found}'? のエラー型が一致しない
E1090Type: Type = Type言明不能(イースターエッグ)
E1091Generic meta-type self-reference is not allowed: '{decl}'無効なジェネリックメタ型
E1062Const generic constraint violation: {reason}constジェネリクス制約違反

E2xxx -- セマンティック解析

セマンティック解析段階で発生したエラー。スコープ、変数のライフサイクル、所有権、関数シグネチャの解析などを涵盖。

エラーコードテンプレート説明
E2001Variable '{name}' is not in scopeスコープエラー
E2002Duplicate definition: '{name}' is already defined in this scope重複定義
E2003Ownership constraint violated: {reason}所有権エラー
E2010Cannot assign to immutable variable '{name}'不変変数への代入
E2011Use of uninitialized variable '{name}'未初期化変数の使用
E2012Mutability conflict: cannot use mutable reference in immutable context可変性衝突
E2013Cannot shadow existing variable '{name}'変数のシャドー
E2014'{name}' has been moved and cannot be used移動された変数の使用
E2090Invalid signature: {reason}無効なシグネチャ
E2091Invalid signature: unknown type '{type_name}'シグネチャの不明な型
E2092Invalid signature: missing '->'シグネチャの矢印欠落
E2093Invalid signature: duplicate parameter '{name}'重複パラメータ名
E2094Invalid signature: generic '{name}' shadows outer genericジェネリックパラメータのシャドー
E2095Invalid signature: parameter '{name}' shadows genericパラメータ名がジェネリックをシャドー

E4xxx -- ジェネリクスと特質

ジェネリクス制約と特質システム関連のエラー。

エラーコードテンプレート説明
E4001Type '{type}' does not satisfy the trait bound '{trait}'ジェネリクス制約違反
E4002Trait '{trait}' not found特質が見つからない
E4003Missing implementation for trait '{trait}' for type '{type}'特質実装欠落
E4004Conflicting trait implementations for '{trait}'特質実装の競合
E4005Associated type '{assoc_type}' not found in '{container}'関連型が見つからない

E5xxx -- モジュールとインポート

モジュールシステムとインポート関連のエラー。

エラーコードテンプレート説明
E5001Module '{module}' not foundモジュールが見つからない
E5002Failed to import module '{module}': {reason}インポートエラー
E5003Export '{export}' not found in module '{module}'エクスポートが見つからない
E5004Circular dependency detected: {path}循環依存
E5005Invalid module path: '{path}'無効なモジュールパス
E5006Duplicate import: '{name}' is already imported重複インポート
E5007Module '{module}' exports: {available}モジュールエクスポートのヒント

E6xxx -- ランタイム

ランタイム段階で発生したエラー。

エラーコードテンプレート説明
E6001Division by zero in expression: {expr}ゼロ除算エラー
E6002Null pointer dereference at {location}nullポインタdereference
E6003Array index out of bounds: valid range is 0..{max}, found {index}配列インデックスが範囲外
E6004Stack overflow: recursion depth exceeded limit {limit}スタックオーバーフロー
E6005Assertion failed: {condition}アサーション失敗
E6006Function not found: '{func}'関数が見つからない(ランタイム)
E6007Runtime error: {message}ランタイムエラー

E7xxx -- I/O とシステム

I/O 操作とシステムレベルのエラー。

エラーコードテンプレート説明
E7001File not found: '{path}'ファイルが見つからない
E7002Permission denied: '{path}'権限が拒否された
E7003I/O error: {reason}I/O エラー
E7004Network error: {reason}ネットワークエラー

E8xxx -- 内部コンパイラエラー

コンパイラの内部エラー。通常はコンパイラ自体バグを示します。この種のエラーが発生した場合は、GitHub Issues でご報告ください。

エラーコードテンプレート説明
E8001Internal compiler error: {message}内部コンパイラエラー
E8002Unexpected compiler panic: {reason}予期しないPanic
E8003Compiler phase error: {phase} - {message}コンパイラフェーズエラー

W1xxx -- 警告

デッドコード検出関連の警告。警告はコンパイルを阻止しませんが、コードに潜在的な問題があることを示します。

エラーコードテンプレート説明
W1001Unused exported function: '{name}'未使用のエクスポート関数
W1002Unused exported type: '{name}'未使用のエクスポート型
W1003Unused import: '{name}'未使用のインポート
W1004Unused exported variable: '{name}'未使用のエクスポート変数
W1005Unused exported method: '{name}'未使用のエクスポートメソッド

| W1063 | Const generic constraint not evaluable at compile time |

constジェネリクス制約はコンパイル時に評価できない

合計 85 の診断コード(79 のエラーコード + 6 の警告コード)。