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
This is a bit of a more general issue, but some error messages could really use some improvements.
This is not a bug, the compiler is correct here, but the messages are rather confusing (unspecific):
package main
main :: proc() { }
A :: enum { A, B, C, D };
E :: bit_set[A; i32]
F :: E{ .A , .B }
xx :: E{ .C , .D , .F } // malformed 1
xxx :: i32(E{ .C , .D , .F }) // malformed 2
This is malformed, and the compiler will give you the following errors:
malformed 1:
C:/Users/Rennorb/source/tests/test.odin(9:7) Error: 'E{.C, .D, .F}' is not a compile-time known constant
xx :: E{ .C , .D , .F }
^~~~~~~~~~~~~~~~^
C:/Users/Rennorb/source/tests/test.odin(9:21) Error: Undeclared name 'F' for type 'enum int {A, B, C, D}'
xx :: E{ .C , .D , .F }
^
Suggestion: Did you mean?
A
B
C
D
This is correct ofcourse, but the first message is completely pointless, even though it gets emitted first. It is like saying "this program is malformed". Technically true, but adds nothing of value.
The second one is a lot worse though imo:
malformed 2:
C:/Users/Rennorb/source/tests/test.odin(11:8) Error: Invalid declaration value 'i32(E{.C, .D, .F})'
xxx :: i32(E{ .C , .D , .F })
^~~~~~~~~~~~~~~~~~~~~^
C:/Users/Rennorb/source/tests/test.odin(11:12) Error: Cannot cast 'E{.C, .D, .F}' as 'i32' from 'bit_set[A; i32]'
xxx :: i32(E{ .C , .D , .F })
^~~~~~~~~~~~~~~~^
C:/Users/Rennorb/source/tests/test.odin(11:26) Error: Undeclared name 'F' for type 'enum int {A, B, C, D}'
xxx :: i32(E{ .C , .D , .F })
^
Suggestion: Did you mean?
A
B
C
D
Again, technically true, but on an intuitive level the declaration is not invalid. Its just that .F is not a member of the enum, but a separate "union" of flags.
The second error is also only technically true, but only because (i assume) the declaration gets marked as invalid and therefore cannot be cast. For all intents and purposes this error is worse than pointless, because it hides the actual issue. You can cast a bitset(i32) to i32 just fine.
Only on the last line the actual error is stated: F is not a member of the enum.
All of this is incredibly noisy and reminds me of cpp errors, which i hoped to get away from.
In both cases the last error is completely sufficient, and everything else is plain noise.
odin report:
Useful information to add to a bug report:
Odin: dev-2024-12-nightly:cf53404
OS: Windows 10 Enterprise N (version: 20H2), build 19042.1466
CPU: Intel(R) Core(TM) i5-8400 CPU @ 2.80GHz
RAM: 65470 MiB
Backend: LLVM 18.1.8
The text was updated successfully, but these errors were encountered:
This is a bit of a more general issue, but some error messages could really use some improvements.
This is not a bug, the compiler is correct here, but the messages are rather confusing (unspecific):
This is malformed, and the compiler will give you the following errors:
malformed 1:
This is correct ofcourse, but the first message is completely pointless, even though it gets emitted first. It is like saying "this program is malformed". Technically true, but adds nothing of value.
The second one is a lot worse though imo:
malformed 2:
Again, technically true, but on an intuitive level the declaration is not invalid. Its just that .F is not a member of the enum, but a separate "union" of flags.
The second error is also only technically true, but only because (i assume) the declaration gets marked as invalid and therefore cannot be cast. For all intents and purposes this error is worse than pointless, because it hides the actual issue. You can cast a bitset(i32) to i32 just fine.
Only on the last line the actual error is stated: F is not a member of the enum.
All of this is incredibly noisy and reminds me of cpp errors, which i hoped to get away from.
In both cases the last error is completely sufficient, and everything else is plain noise.
odin report:
Useful information to add to a bug report:
The text was updated successfully, but these errors were encountered: