Diagnostics · semantic
semantic[clause-source]
An executable clause without a source tag, found by validateContract.
compileSource reports this case earlier, as unsupported[forbid-form] or unsupported[ensure-form]. It appears when validateContract is called directly on a parsed contract.
Example
validateContractCONTRACT Claim {
ENFORCEMENT_MODE: enforced
CONTEXT {
ENTITIES Request {
count: int
region: string
ready: bool
ratio: float
}
CONSTANTS {
zero: int == 0 [SOURCE:POLICY]
cap: int == 25 [SOURCE:POLICY]
}
}
TRIGGER {
grant()
}
GUARANTEE {
ENSURE grant() WHEN Request.ready == true [SOURCE:must_be_ready]
}
PROHIBITION {
FORBID grant WHEN Request.count > cap
}
}rejected semantic[clause-source] at 22:5 every executable clause requires a named SOURCE ID
compileSource reports unsupported[forbid-form] for this source instead, because that check comes first.
Fix
validateContractCONTRACT Claim {
ENFORCEMENT_MODE: enforced
CONTEXT {
ENTITIES Request {
count: int
region: string
ready: bool
ratio: float
}
CONSTANTS {
zero: int == 0 [SOURCE:POLICY]
cap: int == 25 [SOURCE:POLICY]
}
}
TRIGGER {
grant()
}
GUARANTEE {
ENSURE grant() WHEN Request.ready == true [SOURCE:must_be_ready]
}
PROHIBITION {
FORBID grant WHEN Request.count > cap [SOURCE:over_cap]
}
}accepted
See also: the docs.