Skip to content
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

The compiler crashed when compiling an element. #53704

Closed
manandhar-aarya opened this issue Oct 9, 2023 · 2 comments
Closed

The compiler crashed when compiling an element. #53704

manandhar-aarya opened this issue Oct 9, 2023 · 2 comments
Labels
area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) web-dart2js

Comments

@manandhar-aarya
Copy link

I am trying to use JavaScript interop library to call a js function of stripe. it says that the compiler crashed on this line:

Internal Error: The compiler crashed when compiling this element.

external (dynamic paymentIntent, dynamic error) confirmCardPayment(String clientSecret, [Map paymentMethod, Map handleError]);
                                                ^
The compiler is broken.`

Here are my environment details:
[✓] Flutter (Channel stable, 3.10.4, on macOS 13.2.1 22D68 darwin-arm64, locale en-GB)
• Flutter version 3.10.4 on channel stable at /Users/aaryamanandhar/Libraries/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 682aa387cf (4 months ago), 2023-06-05 18:04:56 -0500
• Engine revision 2a3401c9bb
• Dart version 3.0.3
• DevTools version 2.23.1

Here is the stack trace:
The compiler crashed: UnimplementedError: isNonNullableIfSound (dynamic,dynamic)
#0 DartTypes.isNonNullableIfSound (package:compiler/src/elements/types.dart:2423:5)
#1 KernelSsaGraphBuilder._buildExternalNativeFunctionNode (package:compiler/src/ssa/builder.dart:1701:23)
#2 KernelSsaGraphBuilder._buildExternalFunctionNode (package:compiler/src/ssa/builder.dart:1587:7)
#3 KernelSsaGraphBuilder.build. (package:compiler/src/ssa/builder.dart:468:15)
#4 DiagnosticReporter.withCurrentElement (package:compiler/src/diagnostics/diagnostic_listener.dart:142:15)
#5 KernelSsaGraphBuilder.build (package:compiler/src/ssa/builder.dart:456:21)
#6 KernelSsaBuilder.build. (package:compiler/src/js_model/js_strategy.dart:563:22)
#7 CompilerTask.measure (package:compiler/src/common/tasks.dart:66:51)
#8 KernelSsaBuilder.build (package:compiler/src/js_model/js_strategy.dart:545:18)
#9 SsaBuilderTask.build (package:compiler/src/ssa/ssa.dart:361:21)
#10 SsaFunctionCompiler.compile (package:compiler/src/ssa/ssa.dart:87:28)
#11 OnDemandCodegenResults.getCodegenResults (package:compiler/src/common/codegen.dart:421:30)
#12 JsBackendStrategy.generateCode (package:compiler/src/js_model/js_strategy.dart:337:43)
#13 KernelCodegenWorkItem.run (package:compiler/src/js_model/js_strategy.dart:504:29)
#14 Compiler.emptyQueue..... (package:compiler/src/compiler.dart:830:70)
#15 CompilerTask.measureSubtask (package:compiler/src/common/tasks.dart:181:35)
#16 Compiler.emptyQueue.... (package:compiler/src/compiler.dart:830:32)
#17 CompilerTask.measureSubtask (package:compiler/src/common/tasks.dart:181:35)
#18 Compiler.emptyQueue... (package:compiler/src/compiler.dart:828:28)
#19 DiagnosticReporter.withCurrentElement (package:compiler/src/diagnostics/diagnostic_listener.dart:142:15)
#20 Compiler.emptyQueue.. (package:compiler/src/compiler.dart:826:18)
#21 CodegenEnqueuer._forEach (package:compiler/src/js_backend/enqueuer.dart:252:12)
#22 CodegenEnqueuer.forEach (package:compiler/src/js_backend/enqueuer.dart:268:5)
#23 Compiler.emptyQueue. (package:compiler/src/compiler.dart:822:16)
#24 CompilerTask.measureSubtask (package:compiler/src/common/tasks.dart:181:35)
#25 Compiler.emptyQueue (package:compiler/src/compiler.dart:821:14)
#26 Compiler.processQueue. (package:compiler/src/compiler.dart:845:7)
#27 CompilerTask.measureSubtask (package:compiler/src/common/tasks.dart:181:35)
#28 Compiler.processQueue (package:compiler/src/compiler.dart:839:14)
#29 Compiler.runCodegenEnqueuer (package:compiler/src/compiler.dart:557:5)
#30 Compiler.runSequentialPhases (package:compiler/src/compiler.dart:771:23)

#31 Compiler.runInternal. (package:compiler/src/compiler.dart:319:7)

#32 Compiler.runInternal (package:compiler/src/compiler.dart:318:5)

#33 Compiler.run. (package:compiler/src/compiler.dart:239:11)

#34 main (package:compiler/src/dart2js.dart:1473:3)

#0 Dart2JSTarget.build (package:flutter_tools/src/build_system/targets/web.dart:226:7)

#1 _BuildInstance._invokeInternal (package:flutter_tools/src/build_system/build_system.dart:847:9)

#2 Future.wait. (dart:async/future.dart:525:21)

#3 _BuildInstance.invokeTarget (package:flutter_tools/src/build_system/build_system.dart:785:32)

#4 Future.wait. (dart:async/future.dart:525:21)

#5 _BuildInstance.invokeTarget (package:flutter_tools/src/build_system/build_system.dart:785:32)

#6 FlutterBuildSystem.build (package:flutter_tools/src/build_system/build_system.dart:614:16)

#7 WebBuilder.buildWeb (package:flutter_tools/src/web/compile.dart:81:34)

#8 ResidentWebRunner.run. (package:flutter_tools/src/isolated/resident_web_runner.dart:324:11)

#9 asyncGuard. (package:flutter_tools/src/base/async_guard.dart:111:24)

Finished with error: Exception: Failed to compile application for the Web.

@lrhn lrhn added web-dart2js type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. labels Oct 9, 2023
@fishythefish
Copy link
Member

fishythefish commented Oct 9, 2023

Closing this issue as already fixed. Dart version 3.0.3 was indeed missing the case for RecordType in isNonNullableIfSound, but the case was added 5 months ago in 1c59f30.

See also #52276.

@sigmundch
Copy link
Member

One quick note in terms of the original example and Dart/JS interop: please note that records are not supported as parameters and return values of interop APIs.

We are in the process of improving interop and making it easier to know when an API is supported or not. The reason you didn't see an error is because these improvements are being done in the new dart:js_interop library which will replace package:js in the long run. The new dart:js_interop will report an error if you try to use records in an external API. You can get a taste of the new APIs in the upcoming Dart 3.2 sdk.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) web-dart2js
Projects
None yet
Development

No branches or pull requests

4 participants