pub enum CompileError {
Show 18 variants
Parse(Diagnostics),
PremiseRedefinition {
name: String,
},
MissingDomain {
file: String,
},
DuplicateDomain {
file: String,
},
UnknownDomain {
domain: String,
},
DomainAliasClash {
alias: String,
},
ImportNotFound(String),
CircularImport(String),
RuleDisjunctiveConsequent {
name: String,
},
UnknownValue(Box<UnknownValue>),
UnknownSet {
file: String,
line: u32,
set: String,
suggestion: String,
},
CyclicRelation {
file: String,
line: u32,
relation: String,
node: String,
},
UndeclaredPort {
file: String,
line: u32,
name: String,
suggestion: String,
},
UnknownPort {
name: String,
suggestion: String,
},
AmbiguousPort {
name: String,
domains: String,
},
UnknownExternalAtom {
name: String,
},
PortConflict {
name: String,
a_value: bool,
a_origin: String,
b_value: bool,
b_origin: String,
},
DataFileStatement {
file: String,
line: u32,
},
}Expand description
Anything that can go wrong while compiling (and resolving imports).
Variants§
Parse(Diagnostics)
A source failed to parse; carries the full syntax diagnostics (every
error, each as a caret block with the keyword’s correct syntax). The
source label is already inside the [Diagnostics] header.
PremiseRedefinition
A name was reused with a different body within the same source.
MissingDomain
A source did not declare its DOMAIN (required, once, as the first
statement).
DuplicateDomain
A source declared DOMAIN more than once (a file has exactly one domain).
UnknownDomain
An atom referenced a domain. prefix that is not the file’s own domain and
was not imported in this file.
DomainAliasClash
Two imports bound the same local domain name to different domains (use a
distinct AS <alias> to tell them apart).
ImportNotFound(String)
An IMPORT target could not be loaded by the [Resolver].
CircularImport(String)
Imports form a cycle (a source transitively imports itself).
RuleDisjunctiveConsequent
A RULE used OR in its THEN: forward chaining cannot derive a
disjunction (it would not know which literal to assert). Model it as a
PREMISE constraint instead.
UnknownValue(Box<UnknownValue>)
A reference used a value outside the closed set an ONEOF declared for that
variable. Almost always a typo: the misspelling would otherwise mint a new
atom that hangs in the air as UNKNOWN. Closed-world is opt-in — it only
applies to a (subject, predicate) whose values an ONEOF enumerated.
Boxed so this comparatively large payload does not bloat every Result.
UnknownSet
A FOR EACH … IN <set> named a set that was never declared with SET.
Usually a typo in the set name; the suggestion offers the nearest declared
set when one is close.
Fields
CyclicRelation
CLOSE <relation> TRANSITIVE found a cycle: a node transitively reaches
itself. Transitive closure requires a DAG (e.g. a dependency graph).
Fields
UndeclaredPort
A bare proposition (a single-word atom like db_ready) was used in the
program but never declared with VAR. Almost always a typo or a forgotten
declaration; the suggestion offers the nearest declared port when close.
Fields
UnknownPort
An external value (--set, API, or PROVIDE) named a port that no VAR
declares. Strict by design: silently ignoring an unknown key would hide a
mistake.
Fields
AmbiguousPort
An external value named a bare target declared in more than one domain, so
which one it sets is ambiguous. Resolve it by qualifying the key with a
domain. prefix.
Fields
UnknownExternalAtom
A multi-word external value (PROVIDE engine has_fuel: true or a --set/API
key with a predicate) named an atom that no statement in the program uses.
Strict by design — like CompileError::UnknownPort, a typo must not be
silently injected as a new fact.
PortConflict
Two sources supplied different values for the same port. Ambiguity is a hard error: the engine is about determinism, so it never silently picks one.
Fields
DataFileStatement
A data file (loaded via --data) contained a statement other than PROVIDE
(or DOMAIN). Data files carry only values, never logic.
Trait Implementations§
Source§impl Debug for CompileError
impl Debug for CompileError
Source§impl Display for CompileError
impl Display for CompileError
impl Eq for CompileError
Source§impl Error for CompileError
impl Error for CompileError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl PartialEq for CompileError
impl PartialEq for CompileError
Source§fn eq(&self, other: &CompileError) -> bool
fn eq(&self, other: &CompileError) -> bool
self and other values to be equal, and is used by ==.