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

Crash when compiling card.dart: type 'int' is not a subtype of type 'Constructor' in type cast #51402

Open
lukehutch opened this issue Feb 14, 2023 · 1 comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.

Comments

@lukehutch
Copy link

I got the following spurious Dart compiler crash while compiling a Flutter app. (I can't reproduce this, and I don't know what caused it.)

Unhandled exception:
Crash when compiling file:///opt/flutter/packages/flutter/lib/src/material/card.dart at character offset 5744:
card.dart:1
type 'int' is not a subtype of type 'Constructor' in type cast

#0      Reference.asConstructor (package:kernel/canonical_name.dart:533:17)
#1      ConstructorInvocation.target (package:kernel/ast.dart:6982:45)
#2      InferenceVisitorImpl.visitConstructorInvocation (package:front_end/src/fasta/type_inference/inference_visitor.dart:889:27)
#3      ConstructorInvocation.accept1 (package:kernel/ast.dart:7003:9)
#4      InferenceVisitorImpl._inferExpression (package:front_end/src/fasta/type_inference/inference_visitor.dart:181:27)
#5      InferenceVisitorImpl.inferExpression (package:front_end/src/fasta/type_inference/inference_visitor.dart:216:40)
#6      InferenceVisitorImpl.visitConditionalExpression (package:front_end/src/fasta/type_inference/inference_visitor.dart:873:9)
#7      ConditionalExpression.accept1 (package:kernel/ast.dart:7304:9)
#8      InferenceVisitorImpl._inferExpression (package:front_end/src/fasta/type_inference/inference_visitor.dart:181:27)

#9      InferenceVisitorImpl.inferExpression (package:front_end/src/fasta/type_inference/inference_visitor.dart:216:40)
#10     InferenceVisitorImpl.visitVariableDeclaration (package:front_end/src/fasta/type_inference/inference_visitor.dart:7935:11)
#11     VariableDeclaration.accept (package:kernel/ast.dart:11226:43)
#12     InferenceVisitorImpl.inferStatement (package:front_end/src/fasta/type_inference/inference_visitor.dart:159:26)
#13     InferenceVisitorImpl._visitStatements (package:front_end/src/fasta/type_inference/inference_visitor.dart:741:50)
#14     InferenceVisitorImpl.visitBlock (package:front_end/src/fasta/type_inference/inference_visitor.dart:762:31)
#15     Block.accept (package:kernel/ast.dart:9638:43)
#16     InferenceVisitorImpl.inferStatement (package:front_end/src/fasta/type_inference/inference_visitor.dart:159:26)
#17     TypeInferrerImpl.inferFunctionBody (package:front_end/src/fasta/type_inference/type_inferrer.dart:187:17)
#18     BodyBuilder.finishFunction (package:front_end/src/fasta/kernel/body_builder.dart:1306:43)
#19     DietListener.buildFunctionBody (package:front_end/src/fasta/source/diet_listener.dart:1112:19)
#20     DietListener._endClassMethod (package:front_end/src/fasta/source/diet_listener.dart:750:5)
#21     DietListener.endClassMethod (package:front_end/src/fasta/source/diet_listener.dart:689:5)
#22     Parser.parseMethod (package:_fe_analyzer_shared/src/parser/parser_impl.dart:4718:20)
#23     Parser.parseClassOrMixinOrExtensionOrEnumMemberImpl (package:_fe_analyzer_shared/src/parser/parser_impl.dart:4435:15)
#24     Parser.parseClassOrMixinOrExtensionBody (package:_fe_analyzer_shared/src/parser/parser_impl.dart:4080:15)
#25     Parser.parseClass (package:_fe_analyzer_shared/src/parser/parser_impl.dart:2532:13)
#26     Parser.parseClassOrNamedMixinApplication (package:_fe_analyzer_shared/src/parser/parser_impl.dart:2490:14)
#27     Parser.parseTopLevelKeywordDeclaration (package:_fe_analyzer_shared/src/parser/parser_impl.dart:628:14)
#28     Parser.parseTopLevelDeclarationImpl (package:_fe_analyzer_shared/src/parser/parser_impl.dart:524:14)
#29     Parser.parseUnit (package:_fe_analyzer_shared/src/parser/parser_impl.dart:404:15)
#30     SourceLoader.buildBody (package:front_end/src/fasta/source/source_loader.dart:1260:12)

<asynchronous suspension>
#31     SourceLoader.buildBodies (package:front_end/src/fasta/source/source_loader.dart:673:7)
<asynchronous suspension>
#32     KernelTarget.buildComponent.<anonymous closure> (package:front_end/src/fasta/kernel/kernel_target.dart:612:7)
<asynchronous suspension>
#33     withCrashReporting (package:front_end/src/fasta/crash.dart:136:12)
<asynchronous suspension>
#34     IncrementalCompiler.computeDelta.<anonymous closure> (package:front_end/src/fasta/incremental_compiler.dart:413:23)
<asynchronous suspension>
#35     IncrementalCompiler.compile (package:vm/incremental_compiler.dart:68:50)
<asynchronous suspension>
#36     FrontendCompiler.compile (package:frontend_server/frontend_server.dart:574:11)
<asynchronous suspension>
#37     starter (package:frontend_server/starter.dart:99:12)
<asynchronous suspension>
#38     main (file:///b/s/w/ir/x/w/sdk/pkg/frontend_server/bin/frontend_server_starter.dart:13:14)
<asynchronous suspension>
2

Target kernel_snapshot failed: Exception
2

FAILURE: Build failed with an exception.
* Where:
Script '/opt/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 1151

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command '/opt/flutter/bin/flutter'' finished with non-zero exit value 1
  • Dart SDK Version (dart --version): 2.19.2
  • Whether you are using Windows, MacOSX, or Linux (if applicable): Linux
  • Whether you are using Chrome, Safari, Firefox, Edge (if applicable): Chrome
@mraleph mraleph added the area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. label Feb 14, 2023
@mraleph
Copy link
Member

mraleph commented Feb 14, 2023

Thanks for reporting this. int can never appear in this place, so it is likely a JIT problem. That being said: unlikely that we can figure this out without a reproduction.

/cc @alexmarkov @mkustermann

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.
Projects
None yet
Development

No branches or pull requests

2 participants