-
-
Notifications
You must be signed in to change notification settings - Fork 419
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
Unreported internal error when matching array of U8 #4554
Comments
The "internal failure not reported" message is shown when a compiler pass fails, but did not emit any errors explaining why it failed. The right course of action here is for someone to troubleshoot (probably by running ponyc under a debugger like lldb or gdb) exactly where/why the pass is failing, and add code that emits an appropriate error for that. |
in if(is_typecheck_error(pattern_type))
return NULL;
In our case at this point, the issue is that The failure here happens in the expression pass. In this particular case, we should be able to infer that the values are U8 because the array is U8. And we should be able to give a compiler error if the values are not representable as a U8. That however, is an extensive bit of code. I think for our "good first issue" version of this, we could set an error message in
Thoughts @ponylang/committer? |
We discussed during sync and the "basic error that type of pattern couldn't be determined" is fine for anyone wanting to do the "good first issue" version of this. |
Note, the type antecedent stuff here works for non-array's just not arrays. this compiles fine: actor Main
new create(env: Env) =>
let arr = U8(4)
match arr
| 2 => env.out.print("two and three")
| 3 => env.out.print("four and five")
else
env.out.print("something else")
end |
The following code causes ponyc to return
Error: internal failure not reported
:This modified version instead (correctly) gives a compile error, because Array does not implement eq:
Reproduced on my machine using ponyc 0.58.0-a161b7c9 and on the playground with ponyc 0.58.6-41be76e.
The text was updated successfully, but these errors were encountered: