Skip to content

[dart2js] crash when using records with null-assertions #52276

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sigmundch opened this issue May 5, 2023 · 0 comments
Closed

[dart2js] crash when using records with null-assertions #52276

sigmundch opened this issue May 5, 2023 · 0 comments
Assignees
Labels
area-web-js Issues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop. P2 A bug or feature request we're likely to work on web-dart2js

Comments

@sigmundch
Copy link
Member

sigmundch commented May 5, 2023

This program crashes during SSA:

main() => foo((1, 2));
foo((int, int) p) {
  print(p);
}

With the following stack when run as: dart compile js --null-assertions repro.dart

The compiler crashed: UnimplementedError: isNonNullableIfSound (int,int)
#0      DartTypes.isNonNullableIfSound (package:compiler/src/elements/types.dart:2423:5)
#1      KernelSsaGraphBuilder._potentiallyAssertNotNull (package:compiler/src/ssa/builder.dart:1615:20)
#2      KernelSsaGraphBuilder._potentiallyCheckInlinedParameterTypes.<anonymous closure> (package:compiler/src/ssa/builder.dart:6752:11)
#3      forEachOrderedParameter.handleParameter (package:compiler/src/js_model/element_map.dart:602:6)
#4      forEachOrderedParameterByFunctionNode (package:compiler/src/js_model/element_map.dart:574:6)
#5      forEachOrderedParameter (package:compiler/src/js_model/element_map.dart:610:9)
#6      KernelSsaGraphBuilder._potentiallyCheckInlinedParameterTypes (package:compiler/src/ssa/builder.dart:6738:5)
#7      KernelSsaGraphBuilder._visitInlinedFunction (package:compiler/src/ssa/builder.dart:6687:5)
#8      KernelSsaGraphBuilder._doInline (package:compiler/src/ssa/builder.dart:6682:5)
#9      KernelSsaGraphBuilder._doTryInlineMethod.doInlining.<anonymous closure> (package:compiler/src/ssa/builder.dart:6375:11)
#10     KernelSsaGraphBuilder._inlinedFrom.<anonymous closure> (package:compiler/src/ssa/builder.dart:962:21)
#11     DiagnosticReporter.withCurrentElement (package:compiler/src/diagnostics/diagnostic_listener.dart:142:15)
#12     KernelSsaGraphBuilder._inlinedFrom (package:compiler/src/ssa/builder.dart:960:14)
#13     KernelSsaGraphBuilder._doTryInlineMethod.doInlining (package:compiler/src/ssa/builder.dart:6370:7)
#14     KernelSsaGraphBuilder._doTryInlineMethod (package:compiler/src/ssa/builder.dart:6382:7)
#15     KernelSsaGraphBuilder._tryInlineMethod (package:compiler/src/ssa/builder.dart:6135:21)
#16     KernelSsaGraphBuilder._pushStaticInvocation (package:compiler/src/ssa/builder.dart:5321:9)
#17     KernelSsaGraphBuilder.visitStaticInvocation (package:compiler/src/ssa/builder.dart:4248:7)
#18     StaticInvocation.accept (package:kernel/ast.dart:7041:44)

Note that --null-assertions this is only valuable with mixed-mode programs using unsound null safety, so this doesn't affect users of Dart 3 and the fix doesn't need to be cherry-picked.

It does reveal that our compiler still allows using this flag with sound programs, which is unnecessary and may require additional cleanup.

@sigmundch sigmundch added web-dart2js P2 A bug or feature request we're likely to work on area-web-js Issues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop. labels May 5, 2023
@sigmundch sigmundch self-assigned this May 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-web-js Issues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop. P2 A bug or feature request we're likely to work on web-dart2js
Projects
None yet
Development

No branches or pull requests

1 participant