-
Notifications
You must be signed in to change notification settings - Fork 166
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
Array shape is zero but array contains elements. #2005
Comments
The problem here is that the size of the This may be a bit tricky to solve in a very nice way without restructuring how we represent sum types in the type checker, by using some kind of row type variable. There is a rather rigid solution, which would be to detect and reject these cases (which is not so difficult), which can then be worked around by the programmer by adding an explicit type annotation to the constructor usage sites. |
Shouldn't |
That's an interesting perspective that I had not considered. I don't think we ever clarified the rules for which sizes are witnessed by a sum type. |
As I understood witnessing, sum type should witness the intersection of every constructor witnesses. |
Yes, there is a real bug that will need to be fixed, regardless of what we decide with witnesses. Your intuition of sum type witnesses being the intersection of the witnesses of each constructor is fine as such. What I'm wondering is whether it is too restrictive. It would be bad if we ruled out too many useful programs. In practice, sum types are desugared to records, so we actually keep all constructors around at runtime (in a sense). |
Error replication.
The test in the following piece of code does not succeed.
When running the tests it responds with.
I would think the shape of the output of
f
should be[3]
for the input"uvv"
. When I use the function in the REPL, I also see that the shape is[0]
but the array contains elements.Also note that when testing with the interpreter the test succeeds
futhark test -i error.fut
.Version
The text was updated successfully, but these errors were encountered: