Constraint Solver¶
check_constraints(module) walks a parsed Module and reports
well-formedness violations (residuated context, effect-name
convention, bundle-member resolvability) without invoking the full
compiler.
Import from the submodule directly:
from quivers.dsl.constraints import check_constraints, Violation
These names are not re-exported from quivers.dsl.
constraints
¶
Static constraint solver for QVR modules.
Walks a parsed Module and reports well-formedness violations
that the unified resolver or the compiler would otherwise only
surface at the point of use:
residuated_constraint:ObjectSlashpatterns must reference a residuated universe (a previously-declaredTypeFreeResiduated) at every binding site. Schema parameters typed as a residuated universe are recognized; bareObjectSlashoutside a residuated context is flagged.effect_constraint:ObjectEffectApplyreferences must name an effect with a conventional name (PascalCase or underscore-containing); other identifiers are flagged.bundle_unknown_member: bundle-decl members that do not resolve at parse time (rules / schemas / built-in schema names / other bundles). The LSP relies on this so it can surface bundle problems without invoking the compiler.
The solver consumes the parsed AST only; it never invokes the
compiler. Returned diagnostics are Violation records that
the qvr check CLI lifts into structured Diagnostic instances.
Violation
¶
Bases: Model
One constraint-solver finding.
check_constraints
¶
Return every well-formedness violation in module.
Walks the statements in source order, building up the symbol tables (residuated universes, enum sets, free monoids, declared rule / schema / bundle names) incrementally so that out-of-order references are flagged.
Source code in src/quivers/dsl/constraints.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 | |