Unreachable code warning is not emitted if panic is called as a funcion #3973
Replies: 6 comments
-
Hello! Do you not think the existing warnings highlights that the code doesn't work? |
Beta Was this translation helpful? Give feedback.
-
The warnings are fine. The issue is that, once the warning "Panic used as a function" is resolved by removing |
Beta Was this translation helpful? Give feedback.
-
I don't mind either way really! |
Beta Was this translation helpful? Give feedback.
-
I've been interested in Gleam for a while, and taking advantage of the currently running AoC, I decided to try the language and maybe contribute back. (Shout out to @lpil, thank you for the language). Looking for a good first contribution, I was gonna try to send a PR fixing this scenario, but after pondering on it I came to the conclusion that maybe it wasn't a great idea. If I may add to the discussion, I don't think it's ideal to assume we know better than the programmer the intention behind the program. Telling the programmer that I can see a scenario when the programmer actually meant to write Just adding my two cents here. If the community decides that both errors should be thrown in advance, I'd be glad to contribute with a PR for this. |
Beta Was this translation helpful? Give feedback.
-
Sorry, I'm not sure what you're suggesting we do here. If there a new error message you'd like to propose? Thanks |
Beta Was this translation helpful? Give feedback.
-
I'm suggesting we leave the current behavior as currently is, not displaying both warnings in advance. |
Beta Was this translation helpful? Give feedback.
-
For this code
the compiler emits the warning "Panic used as a function" but not "Unreachable code" for f.
Beta Was this translation helpful? Give feedback.
All reactions