Report structured import origins in diagnostics

This commit is contained in:
2026-08-11 19:20:11 +09:00
parent 165daada23
commit 08603dc4b5
6 changed files with 339 additions and 31 deletions
@@ -11,6 +11,7 @@ Diagnostic {
span: Span
message: String
labels: Vec<DiagnosticLabel>
notes: Vec<String>
}
DiagnosticLabel {
@@ -22,6 +23,7 @@ DiagnosticLabel {
`span` は primary location を示す。
表示時には `Span.source` を source id のまま出すのではなく、可能な限り file path や virtual file name に解決する。
`labels` は同じ error に関係する追加 location を示す。
`notes` は source location を持たない semantic context を示す。
合成や materialize の失敗では、衝突した constraint、value、default、または処理中 field path を label に含める。
代表的な diagnostic kind:
@@ -37,6 +39,9 @@ DiagnosticLabel {
- match failure
- materialization failure
Structured imports use semantic provenance rather than synthetic source spans.
Constraint failures report the imported value's stable key and logical field or array path alongside the source span of the Decodal constraint that rejected it.
## エラーは値ではない
評価失敗は `RuntimeValue` ではなく `Diagnostic` を返す。