-
-
Notifications
You must be signed in to change notification settings - Fork 47
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
Ints and reals not promoted properly in complex function signatures #998
Comments
It seems like the issue comes from this code in SignatureMismatch: stanc3/src/middle/SignatureMismatch.ml Lines 117 to 121 in 763421b
Adding | UnsizedType.(UComplex, UReal) when depth < 1 -> None
| UnsizedType.(UComplex, UInt) when depth < 1 -> None resolves this issue. Should we be using |
add
etc for complex numbers
@SteveBronder can you help with the second bullet point here? We can use static_cast but will need to cast to the correct thing, either double or var, depending on context. |
The only difference between It is indeed quite awkward to have two separate functions that do the same thing. |
The UnsizedType version seems to only be used to check operators like =-*/ etc. We could probably replace it with the SignatureMismatch version, though at the moment that creates a circular dependency. I'll open a separate issue about that, the rest of this seems more pressing currently |
Yes, that's correct as far as |
Yes, its a similar problem to what's preventing us from making arrays truly covariant - C++'s template resolution for function calls doesn't handle all these promotions the way we'd like. |
Currently, this does not compile (throws a signature error):
This creates a C++ error:
double
tostd::complex<T>
in function callsThe text was updated successfully, but these errors were encountered: