Different behavior when adding multiple cascaded invocations of the same method in dart2js O1, O2 (Not an issue in O3)

Hi Dart team!

This issue reproduces in Dart 2.4.1, as well as what’s currently on Dartpad, which I would assume is the latest stable release (2.5.2)

We ran into a pretty vexing issue this week. We’re getting this traceback:

Uncaught TypeError: Cannot read property 'name' of undefined
    at Object._isSubtype (<anonymous>:674:33)
    at Object.assertIsSubtype (<anonymous>:570:14)
    at main (<anonymous>:959:9)
    at dartMainRunner (<anonymous>:18:5)
    at <anonymous>:1235:7
    at <anonymous>:1221:7
    at dartProgram (<anonymous>:1232:5)
    at <anonymous>:1239:3
    at replaceJavaScript (frame.html:34)
    at messageHandler (frame.html:50)

From this: https://dartpad.dartlang.org/8bce996480f42e85a2522845d9b8af6d

What’s very interesting is that calling combineNested with a single cascaded invocation triggers the failure, but adding a second cascaded invocation obviates the issue! Additionally, when the multiple cascaded invocations are present, the single cascade magically works!

As far as we can tell, the typing is entirely valid for that code. That also works in ddc + dart2js -O3, but not O2 or O1. I would assume that dartpad uses O1, is that correct?

Author: Fantashit

1 thought on “Different behavior when adding multiple cascaded invocations of the same method in dart2js O1, O2 (Not an issue in O3)

Comments are closed.