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)
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
mainand on thebetabranch (3.14.0-211.1). It is absent on thestablebranch (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.dartplus the regression testtests/web/wasm/issue_64153_test.dartadded in the same commit, and it applies cleanly on top of the stable branch as far as I can tell.Issue Description
InstanceInvocation.resultTypewas added without adding the field to the kernel visitors.StaticInteropClassErasertherefore transformsfunctionTypebut notresultType, TFA infers anEmptyTypefor the call result and removes the enclosing function as unreachable. At runtime the call site throws:The failure is silent at build time and only appears at runtime in a release Wasm build.
In
cloud_firestorethis breaks every Firestore query that uses a cursor (startAt,startAfter,endAt,endBeforeand the*Documentvariants) and everyFilter.or/Filter.andquery, becausecloud_firestore_webroutes all of them throughcallMethodVarArgs<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
resultTypevisitor calls toInstanceInvocation, soStaticInteropClassErasererases the static interop type in the result type as well.Why cherry-pick
Filter.or, or to abandoning--wasmentirely.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)