Skip to content

[dart2js] HTypeKnown not removed when Object #60464

@rakudrama

Description

@rakudrama

After c5adfd2, dart2js inserts HtypeKnown nodes to track promotion

int tt() => 3;

main() {
  final int? a = tt();
  if (a != null) {
    print('$a');  // promoted to `int`
  }

  final Object? b = tt();
  if (b != null) {
    print('$b');  // promoted to `Object`
  }
}

The generated main is

    main() {
      A.print("3");
      A.print("" + 3);
    }

The HTypeKnown for promotion to int is removed (tt is inlined, so a is 3), but that for Object is not removed, impairing the constant folding of interpolation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-web-jsIssues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop.dart2js-optimizationweb-dart2js

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions