-
Notifications
You must be signed in to change notification settings - Fork 0
feat(compiler): add span to inconsistent constraints #117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
|
||
| state.constraint_span_map.insert( | ||
| constraint, | ||
| Span { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use self.span instead of manually constructing the span.
core/compiler/src/compile.rs
Outdated
| { | ||
| state.fallback_constraints_used.push(constraint.clone()); | ||
| state.solver.constrain_eq0(constraint); | ||
| state.solver.constrain_eq0(constraint, None); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might still need to store the span in the FallbackConstraint struct if you aren't able to get the span otherwise here. We want to be able to debug fallback constraints as well.
core/compiler/src/compile.rs
Outdated
| }); | ||
| } | ||
|
|
||
| let inconsistent_errors = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It shouldn't be necessary to collect everything into a new Vec, what error were you getting before? I know you mentioned it earlier, but didn't realize it should have been fixable.
core/compiler/src/compile.rs
Outdated
| }); | ||
| } else { | ||
| state.solver.constrain_eq0(expr); | ||
| state.solver.constrain_eq0(expr, None); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this None?
core/compiler/src/solver.rs
Outdated
| /// Constrains the value of `expr` to 0. | ||
| /// TODO: Check if added constraints conflict with existing solution. | ||
| pub fn constrain_eq0(&mut self, expr: LinearExpr) -> ConstraintId { | ||
| pub fn constrain_eq0(&mut self, expr: LinearExpr, span: Option<Span>) -> ConstraintId { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry to make you change this back, but I realized that it is probably a bad abstraction to have the solver know about Spans. The reason we made you change it is that it didn't seem elegant to put the Span in multiple structs, but it would be better for the ExecPass to simply have a ConstraintId to Span map.
1d7781b to
a9dd2cb
Compare
No description provided.