ID:2750423
 
BYOND Version:514
Operating System:Windows 10 Home 64-bit
Web Browser:
Applies to:DM Language
Status: Open

Issue hasn't been assigned a status value.
Descriptive Problem Summary: switch() range cases like `if(var_x to var_y)` aren't erroring when the var is not a constant expression, and it's causing incorrect behavior.

Numbered Steps to Reproduce Problem: Just see the code snippet below. Note that replacing `var/T` with `var/const/T` fixes it, but BYOND should already be throwing an "Expected a constant expression" error anyways. Currently there is no error.

Code Snippet (if applicable) to Reproduce Problem:
proc/test_code()
var/T = 5
switch(1)
if(T to 10e31)
world.log << "Yes"
else
world.log << "No"


Expected Results: "No"

Actual Results: "Yes"

Does the problem occur:
Every time? Or how often? Every time.
In other games? N/A
In other user accounts? N/A
On other computers? N/A

When does the problem NOT occur? When it's actually a constant expression.

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.) Didn't check.

Workarounds: Fix it to be a constant expression.

Bumping this because I saw it be a problem in production code yesterday.