View Issue Details

IDProjectCategoryView StatusLast Update
0030580RunnerVariables (In-Built)Public2019-03-04 16:19
ReporterYellowAfterlifeAssigned ToRussell Kay 
PriorityMediumSeverityC - GeneralReproducibility100%
Status ClosedResolutionFixed 
PlatformWindowsOSWindows 10 ProOS Version>=1703
Product Version2.2.2 
Target Version2.2.2Fixed in Version2.2.2 
Summary0030580: Variables: casting undefined to bool is no longer allowed, neither implicitly or via bool()
DescriptionPreviously GameMaker allowed a pleasantly sensible behaviour where undefined could be cast to boolean implicitly, saving you some minor headache when checking for something that is either true-ish or isn't there. Starting with the recent 2.2.2 beta, it no longer does, which breaks existing code.
var v = undefined;
if (v) {
    show_debug_message("undefined is trueish");
} else show_debug_message("undefined is falseish (OK!)");
if (!v) {
    show_debug_message("!undefined is trueish (OK!)");
} else show_debug_message("!undefined is falseish");
show_debug_message("undefined as bool: " + string(bool(v)));

2.2.1.191:
undefined is falseish (OK!)
!undefined is trueish (OK!)
undefined as bool: 0

2.2.2.308 or 9.9.1.1359:
DoConv :1: illegal undefined/null use

(for any of three things)
TagsRuntime
1.4 Found In
2.x Runtime Found In9.9.1.1359
2.x Runtime Verified In2.2.2.312

Activities

YellowAfterlife

2019-02-28 14:54

Developer  

a_bug.yyz (19,172 bytes)

Russell Kay

2019-03-01 15:07

Manager   ~0063406

Fixed in gitlab

Dan

2019-03-04 09:28

Adminstrator   ~0063412

Runtime 312+

Scott Dunbar

2019-03-04 16:19

Adminstrator   ~0063424

Verified fixed. Closing

IDE 2.2.2.398
Runtime 2.2.2.312