Skip to content

Typeof check output on DottyJS is incorrect #9785

Closed
@djspiewak

Description

@djspiewak

Discovered this as part of trying to port Cats Effect 3's build to DottyJS on 0.27.0-RC1 (SJS 1.2.0). Rough minimization:

if (js.typeOf(js.Dynamic.global.setImmediate) == Undefined) {

(this is part of PolyfillExecutionContext btw)

On Scala 2.13.3 (SJS 1.2.0), this line results in the following:

if (($as_T((typeof setImmediate)) === this.Lcats_effect_unsafe_PolyfillExecutionContext$__f_Undefined)) {

Which is exactly what I would expect. However, on 0.27.0-RC1 we get the following:

if (($as_T((typeof (0, setImmediate))) === this.Lcats_effect_unsafe_PolyfillExecutionContext$__f_Undefined)) {

This obviously doesn't return "undefined" when setImmediate is in fact undefined, meaning that the test is failed and we end up in a code path that isn't expected. This was discovered with Gecko and setImmediate (which is only available on NodeJS 0.9+ and Edge 10+), but it should be reproducible with almost anything.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions