Class: Kumi::Core::Analyzer::Passes::UnsatDetectorPass
- Inherits:
-
VisitorPass
- Object
- PassBase
- VisitorPass
- Kumi::Core::Analyzer::Passes::UnsatDetectorPass
- Includes:
- Syntax
- Defined in:
- lib/kumi/core/analyzer/passes/unsat_detector_pass.rb
Constant Summary collapse
- COMPARATORS =
%i[> < >= <= == !=].freeze
Constants inherited from PassBase
Instance Method Summary collapse
Methods inherited from VisitorPass
Methods inherited from PassBase
contract_declared?, #debug, #debug_enabled?, declared_optional_reads, declared_reads, declared_writes, #initialize, optional_reads, reads, writes
Methods included from ErrorReporting
#inferred_location, #raise_localized_error, #raise_syntax_error, #raise_type_error, #report_enhanced_error, #report_error, #report_semantic_error, #report_syntax_error, #report_type_error
Constructor Details
This class inherits a constructor from Kumi::Core::Analyzer::Passes::PassBase
Instance Method Details
#run(errors) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/kumi/core/analyzer/passes/unsat_detector_pass.rb', line 14 def run(errors) definitions = get_state(:declarations) = get_state(:input_metadata) || {} registry = get_state(:registry) @propagator = FormalConstraintPropagator.new(schema, state) each_decl do |decl| # Only check trait declarations for obvious contradictions next unless decl.is_a?(TraitDeclaration) atoms = extract_equality_atoms(decl.expression, definitions) next if atoms.empty? # Check for formal, obvious contradictions next unless contradicting_equalities?(atoms) || domain_violations?(atoms, ) || propagated_violations?(atoms, definitions, , registry) report_error( errors, "conjunction `#{decl.name}` is impossible", location: decl.loc ) end state end |