You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
error
--> /home/xunilrj/github/sway/test/src/e2e_vm_tests/test_programs/should_pass/language/logging/src/main.sw:59:11
|
57 |
58 |
59 | match F::A {
| ^^^^ Internal compiler error: Failed to get variant type from enum in `unsigned downcast`.
Please file an issue on the repository and include the code that triggered this error.
60 | F::A(x) => {}
61 | }
|
____
The problem seems to be a optimization that we do when an enum only has unit variants (its type is { u64 }, only the discriminant) and the fact that the match "tries" to access the variant data (the second element of the struct).
The text was updated successfully, but these errors were encountered:
Actually, the compilation shouldn't reach the IR generation stage because of the type mismatch. The issue is that we don't check variant type in the pattern against the declared variant type, if the pattern contains variables (as x in the above example). See #6286.
The following code:
generates a compiler error:
The problem seems to be a optimization that we do when an enum only has unit variants (its type is
{ u64 }
, only the discriminant) and the fact that the match "tries" to access the variant data (the second element of the struct).The text was updated successfully, but these errors were encountered: