Skip to content

[CP][stable?] Prevent dart2js crash on flutter web code using package:freezed #48559

Description

@sigmundch

commit(s) to merge: 5090974

merge instructions: needs special cherry-pick CL, but I'd like to discuss first whether we'd approve this hotfix before we create it. It merges cleanly on the beta channel, but not on stable due to some refactoring that occurred in between.

What is the issue: a broken invariant in the kernel representation when there are multiple redirecting factories, this can cause crashes in dart2js downstream.

What is the fix: CFE was updated to fix this invariant by picking the effective target and not the direct target of redirecting calls.

Why cherrypick: The pattern that triggers this bug is commonly generated by package:freezed, a very popular package in the flutter ecosystem. The broken representation silently works in DDC and the VM, but triggers a crash in dart2js for flutter web users.

Risk: low - fix is fairly localized, has been rolled internally.

Link to original issue(s): #47916 (multiple reports merged here, 69+ votes). This is related to flutter/flutter#100038 (a hotfix request on flutter).

/cc @mit-mit @whesse @athomas @vsmenon @devoncarew @johnniwinther

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions