Skip to content

[CP] [dart2wasm] Fix for issue #64153 (TFA removes reachable static interop calls) #64322

Description

@putnokiabel

Commit(s) to merge

Target

stable (3.13.x), so that the fix can reach a Flutter 3.47.x hotfix release.

The fix is present on main and on the beta branch (3.14.0-211.1). It is absent on the stable branch (3.13.4), and the most recent Flutter beta pins Dart 3.14.0-95.2.beta, which predates it. That means no released Flutter channel currently contains the fix, and every Flutter stable user building for Wasm is affected.

Prepared changelist for beta/stable

Not prepared. I am an external reporter and cannot upload a changelist to the release branch. The change is three lines in pkg/kernel/lib/src/ast/expressions.dart plus the regression test tests/web/wasm/issue_64153_test.dart added in the same commit, and it applies cleanly on top of the stable branch as far as I can tell.

Issue Description

InstanceInvocation.resultType was added without adding the field to the kernel visitors. StaticInteropClassEraser therefore transforms functionType but not resultType, TFA infers an EmptyType for the call result and removes the enclosing function as unreachable. At runtime the call site throws:

Attempt to execute code removed by Dart AOT compiler (TFA)

The failure is silent at build time and only appears at runtime in a release Wasm build.

In cloud_firestore this breaks every Firestore query that uses a cursor (startAt, startAfter, endAt, endBefore and the *Document variants) and every Filter.or / Filter.and query, because cloud_firestore_web routes all of them through callMethodVarArgs<JSAny>('apply', ...) to work around the lack of varargs in Dart. Any package that makes an instance interop invocation whose result type is a static interop type can hit the same miscompilation.

What is the fix

Add the missing resultType visitor calls to InstanceInvocation, so StaticInteropClassEraser erases the static interop type in the result type as well.

Why cherry-pick

Risk

Low. The change adds visitor traversal of a field that the visitors already should have traversed, it is confined to pkg/kernel, and the same commit carries a regression test.

Issue link(s)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions