Skip to content

avm1: SWFv5 should coerce functions to 0 #6285

@Toad06

Description

@Toad06
trace(typeof Array); // function
trace(3 - Array); // 3 (NaN in Ruffle)
trace(Array - Array); // 0 (NaN in Ruffle)

function t() {}
trace(typeof t); // function
trace(3 - t); // 3 (NaN in Ruffle)
trace(t - t); // 0 (NaN in Ruffle)


// This behaviour doesn't apply to objects and movie clips.

var a = new Sound();
trace(typeof a); // object
trace(3 - a); // NaN

trace(typeof _root); // movieclip
trace(3 - _root); // NaN

In SWFv6 and the next versions, this behaviour no longer applies as NaN is returned, so everything is correct in Ruffle.

(see #6390 (comment) for how this should get implemented)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-avm1Area: AVM1 (ActionScript 1 & 2)bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions