summaryrefslogtreecommitdiff
path: root/source/Test
diff options
context:
space:
mode:
authoradelon <22380201+adelon@users.noreply.github.com>2026-08-04 09:37:41 +0200
committeradelon <22380201+adelon@users.noreply.github.com>2026-08-04 09:37:41 +0200
commit02231361a87bc7837adf420983aad20e63b2e541 (patch)
tree7c793df14cc797657c79ba42513a46ead99a545d /source/Test
parentdfec6f973615dc73240e50446e7d2c63d4241255 (diff)
Separate declaration semantics from evidence
Diffstat (limited to 'source/Test')
-rw-r--r--source/Test/Unit/Declaration.hs34
1 files changed, 34 insertions, 0 deletions
diff --git a/source/Test/Unit/Declaration.hs b/source/Test/Unit/Declaration.hs
index 78ad27e..56a6c6b 100644
--- a/source/Test/Unit/Declaration.hs
+++ b/source/Test/Unit/Declaration.hs
@@ -146,6 +146,21 @@ enforcesStagedCandidateOrder = do
(Semantic.declarationDeltaFacts
(Declaration.committedBatchDelta batch)))
+ provenance <- runDriver fixture (priorDeclarationUse fixture)
+ case provenance of
+ Declaration.DriverFailed
+ (Declaration.DriverDeclarationFailed
+ (Declaration.CandidateOutsideDeclaration slot))
+ prefix -> do
+ assertEqual
+ "cross-declaration staged premise"
+ (localFact fixture 0)
+ slot
+ assertSingleCompletedPrefix prefix
+ _other ->
+ assertFailure
+ "cross-declaration staged provenance was not rejected"
+
traverse_
(\(label, action, expectedPremise, expectedCandidate) -> do
result <- runDriver fixture action
@@ -234,6 +249,25 @@ enforcesStagedCandidateOrder = do
premise <- Declaration.useStagedCandidate second
pure (Kernel.importedFactDerivation premise))
+ priorDeclarationUse fixture = do
+ (premise, _batch) <- Declaration.commitCompiledDeclaration
+ (Semantic.declarationSyntaxId "prior-stage") do
+ candidate <- Declaration.reserveCandidate
+ (factSpec fixture "prior-stage")
+ Declaration.authorizeCompiledDeclaration
+ (Declaration.authorizeSourceAxiomCandidate candidate)
+ pure candidate
+ void
+ (Declaration.commitCompiledDeclaration
+ (Semantic.declarationSyntaxId "later-stage") do
+ candidate <- Declaration.reserveCandidate
+ (factSpec fixture "later-stage")
+ Declaration.authorizeCompiledDeclaration
+ (Declaration.authorizeKernelProofCandidate candidate do
+ imported <-
+ Declaration.useStagedCandidate premise
+ pure (Kernel.importedFactDerivation imported)))
+
retainsOnlyAppendedPrefixes :: Assertion
retainsOnlyAppendedPrefixes = do
fixture <- makeFixture