Update error span for call argument type mismatch#3287
Conversation
It should be just the argument with the problem. Hopefully, this will make it easy to add quick fixes to some scenarios.
|
The approach seems plausible, but I've only partially reviewed it. Posting to get feedback on the approach. |
| expected: param.clone(), | ||
| actual: arg.clone(), | ||
| span, | ||
| span: *arg_span, |
There was a problem hiding this comment.
One thing that might help me read this is if you renamed the span argument to this function (can't highlight the line since it's outside the diff) to reflect whose span it is. Now that we have two spans getting passed around, it'd be good to disambiguate.
There was a problem hiding this comment.
I genuinely can't tell what that span is. I'm pretty sure it's the span of the whole call. I think it effectively means "here's the span where you should report an error if you find one".
| // However, we do know that the type of Arg must be Eq to the type of Param, so we | ||
| // add that to the constraints. | ||
| (Self::Given(arg), _) => App { | ||
| (Self::Given(arg, arg_span), _) => App { |
There was a problem hiding this comment.
I don't think a Given is the same as a Hole but the comment and implementation seem to be the same as above?
| "}, | ||
| "Microsoft.Quantum.Convert.IntAsDouble(false)", | ||
| &expect![[r#" | ||
| &expect![[r##" |
There was a problem hiding this comment.
I think the baseline update might have done this because I didn't and it wasn't in the list of files copilot had touched.
It should be just the argument with the problem. Hopefully, this will make it easy to add quick fixes to some scenarios.