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

Compiler crashed with "type 'AmbiguousBuilder' is not a subtype of type 'Expression'" #42997

Closed
Hixie opened this issue Aug 9, 2020 · 2 comments
Labels
area-front-end Use area-front-end for front end / CFE / kernel format related issues.

Comments

@Hixie
Copy link
Contributor

Hixie commented Aug 9, 2020

A tried to compile the attached code and the compiler crashed as follows:

$ flutter run
Downloading android-arm-profile/linux-x64 tools...                  0.6s
Downloading android-arm-release/linux-x64 tools...                  0.4s
Downloading android-arm64-profile/linux-x64 tools...                0.4s
Downloading android-arm64-release/linux-x64 tools...                0.5s
Downloading android-x64-profile/linux-x64 tools...                  0.4s
Downloading android-x64-release/linux-x64 tools...                  0.4s
Downloading Web SDK...                                              1.4s
Running "flutter pub get" in dummy_51752...                         0.8s
Launching lib/main.dart on Lenovo TB 8504F in debug mode...
Running Gradle task 'assembleDebug'...
Unhandled exception:
Crash when compiling file:///home/ianh/dev/dummy_51752/lib/main.dart,
at character offset 2511:
type 'AmbiguousBuilder' is not a subtype of type 'Expression'
#0      BodyBuilder.doBinaryExpression (package:front_end/src/fasta/kernel/body_builder.dart:1767:46)
#1      BodyBuilder.endBinaryExpression (package:front_end/src/fasta/kernel/body_builder.dart:1718:7)
#2      Parser.parsePrecedenceExpression (package:_fe_analyzer_shared/src/parser/parser_impl.dart:4644:20)
#3      Parser.parseExpression (package:_fe_analyzer_shared/src/parser/parser_impl.dart:4466:13)
#4      Parser.parseForLoopPartsMid (package:_fe_analyzer_shared/src/parser/parser_impl.dart:6180:15)
#5      Parser.parseForStatement (package:_fe_analyzer_shared/src/parser/parser_impl.dart:6118:13)
#6      Parser.parseStatementX (package:_fe_analyzer_shared/src/parser/parser_impl.dart:4258:14)
#7      Parser.parseStatement (package:_fe_analyzer_shared/src/parser/parser_impl.dart:4217:20)
#8      Parser.parseFunctionBody (package:_fe_analyzer_shared/src/parser/parser_impl.dart:4122:15)
#9      DietListener.buildFunctionBody (package:front_end/src/fasta/source/diet_listener.dart:990:14)
#10     DietListener._endClassMethod (package:front_end/src/fasta/source/diet_listener.dart:714:5)
#11     DietListener.endMixinMethod (package:front_end/src/fasta/source/diet_listener.dart:679:5)
#12     Parser.parseMethod (package:_fe_analyzer_shared/src/parser/parser_impl.dart:3730:20)
#13     Parser.parseClassOrMixinOrExtensionMemberImpl (package:_fe_analyzer_shared/src/parser/parser_impl.dart:3467:15)
#14     Parser.parseClassOrMixinOrExtensionBody (package:_fe_analyzer_shared/src/parser/parser_impl.dart:3141:15)
#15     Parser.parseMixin (package:_fe_analyzer_shared/src/parser/parser_impl.dart:2023:13)
#16     Parser.parseTopLevelKeywordDeclaration (package:_fe_analyzer_shared/src/parser/parser_impl.dart:617:18)
#17     Parser.parseTopLevelDeclarationImpl (package:_fe_analyzer_shared/src/parser/parser_impl.dart:474:14)
#18     Parser.parseUnit (package:_fe_analyzer_shared/src/parser/parser_impl.dart:354:15)
#19     SourceLoader.buildBody (package:front_end/src/fasta/source/source_loader.dart:425:14)
<asynchronous suspension>
#20     Loader.buildBodies (package:front_end/src/fasta/loader.dart:242:15)
#21     KernelTarget.buildComponent.<anonymous closure> (package:front_end/src/fasta/kernel/kernel_target.dart:358:20)
#22     withCrashReporting (package:front_end/src/fasta/crash.dart:122:24)
#23     KernelTarget.buildComponent (package:front_end/src/fasta/kernel/kernel_target.dart:356:12)
#24     IncrementalCompiler.computeDelta.<anonymous closure> (package:front_end/src/fasta/incremental_compiler.dart:274:28)
<asynchronous suspension>
#25     IncrementalCompiler.computeDelta.<anonymous closure> (package:front_end/src/fasta/incremental_compiler.dart)
#26     CompilerContext.runInContext.<anonymous closure>.<anonymous closure> (package:front_end/src/fasta/compiler_context.dart:123:46)
#27     new Future.sync (dart:async/future.dart:223:31)
#28     CompilerContext.runInContext.<anonymous closure> (package:front_end/src/fasta/compiler_context.dart:123:19)
#29     _rootRun (dart:async/zone.dart:1190:13)
#30     _CustomZone.run (dart:async/zone.dart:1093:19)
#31     _runZoned (dart:async/zone.dart:1630:10)
#32     runZoned (dart:async/zone.dart:1550:10)
#33     CompilerContext.runInContext (package:front_end/src/fasta/compiler_context.dart:122:12)
#34     IncrementalCompiler.computeDelta (package:front_end/src/fasta/incremental_compiler.dart:206:20)
#35     IncrementalCompiler.compile (package:vm/incremental_compiler.dart:69:46)
#36     FrontendCompiler.compile.<anonymous closure> (package:frontend_server/frontend_server.dart:524:59)
#37     new Future.<anonymous closure> (dart:async/future.dart:175:37)
#38     _rootRun (dart:async/zone.dart:1182:47)
#39     _CustomZone.run (dart:async/zone.dart:1093:19)
#40     _CustomZone.runGuarded (dart:async/zone.dart:997:7)
#41     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1037:23)
#42     _rootRun (dart:async/zone.dart:1190:13)
#43     _CustomZone.run (dart:async/zone.dart:1093:19)
#44     _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:1021:23)
#45     Timer._createTimer.<anonymous closure> (dart:async-patch/timer_patch.dart:18:15)
#46     _Timer._runTimers (dart:isolate-patch/timer_impl.dart:397:19)
#47     _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:428:5)
#48     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)


#0      DietListener.buildFunctionBody (package:front_end/src/fasta/source/diet_listener.dart:998:7)
#1      DietListener._endClassMethod (package:front_end/src/fasta/source/diet_listener.dart:714:5)
#2      DietListener.endMixinMethod (package:front_end/src/fasta/source/diet_listener.dart:679:5)
#3      Parser.parseMethod (package:_fe_analyzer_shared/src/parser/parser_impl.dart:3730:20)
#4      Parser.parseClassOrMixinOrExtensionMemberImpl (package:_fe_analyzer_shared/src/parser/parser_impl.dart:3467:15)
#5      Parser.parseClassOrMixinOrExtensionBody (package:_fe_analyzer_shared/src/parser/parser_impl.dart:3141:15)
#6      Parser.parseMixin (package:_fe_analyzer_shared/src/parser/parser_impl.dart:2023:13)
#7      Parser.parseTopLevelKeywordDeclaration (package:_fe_analyzer_shared/src/parser/parser_impl.dart:617:18)
#8      Parser.parseTopLevelDeclarationImpl (package:_fe_analyzer_shared/src/parser/parser_impl.dart:474:14)
#9      Parser.parseUnit (package:_fe_analyzer_shared/src/parser/parser_impl.dart:354:15)
#10     SourceLoader.buildBody (package:front_end/src/fasta/source/source_loader.dart:425:14)
<asynchronous suspension>
#11     Loader.buildBodies (package:front_end/src/fasta/loader.dart:242:15)
#12     KernelTarget.buildComponent.<anonymous closure> (package:front_end/src/fasta/kernel/kernel_target.dart:358:20)
#13     withCrashReporting (package:front_end/src/fasta/crash.dart:122:24)
#14     KernelTarget.buildComponent (package:front_end/src/fasta/kernel/kernel_target.dart:356:12)
#15     IncrementalCompiler.computeDelta.<anonymous closure> (package:front_end/src/fasta/incremental_compiler.dart:274:28)
<asynchronous suspension>
#16     IncrementalCompiler.computeDelta.<anonymous closure> (package:front_end/src/fasta/incremental_compiler.dart)
#17     CompilerContext.runInContext.<anonymous closure>.<anonymous closure> (package:front_end/src/fasta/compiler_context.dart:123:46)
#18     new Future.sync (dart:async/future.dart:223:31)
#19     CompilerContext.runInContext.<anonymous closure> (package:front_end/src/fasta/compiler_context.dart:123:19)
#20     _rootRun (dart:async/zone.dart:1190:13)
#21     _CustomZone.run (dart:async/zone.dart:1093:19)
#22     _runZoned (dart:async/zone.dart:1630:10)
#23     runZoned (dart:async/zone.dart:1550:10)
#24     CompilerContext.runInContext (package:front_end/src/fasta/compiler_context.dart:122:12)
#25     IncrementalCompiler.computeDelta (package:front_end/src/fasta/incremental_compiler.dart:206:20)
#26     IncrementalCompiler.compile (package:vm/incremental_compiler.dart:69:46)
#27     FrontendCompiler.compile.<anonymous closure> (package:frontend_server/frontend_server.dart:524:59)
#28     new Future.<anonymous closure> (dart:async/future.dart:175:37)
#29     _rootRun (dart:async/zone.dart:1182:47)
#30     _CustomZone.run (dart:async/zone.dart:1093:19)
#31     _CustomZone.runGuarded (dart:async/zone.dart:997:7)
#32     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1037:23)
#33     _rootRun (dart:async/zone.dart:1190:13)
#34     _CustomZone.run (dart:async/zone.dart:1093:19)
#35     _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:1021:23)
#36     Timer._createTimer.<anonymous closure> (dart:async-patch/timer_patch.dart:18:15)
#37     _Timer._runTimers (dart:isolate-patch/timer_impl.dart:397:19)
#38     _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:428:5)
#39     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)
the Dart compiler exited unexpectedly.
the Dart compiler exited unexpectedly.

Reproduction steps:

  1. flutter create dummy_51752
  2. Replace lib/main.dart with this: main.dart.txt
  3. flutter run
@Hixie
Copy link
Contributor Author

Hixie commented Aug 9, 2020

(The code has many typos and errors in it.)

@a-siva a-siva added the area-front-end Use area-front-end for front end / CFE / kernel format related issues. label Aug 10, 2020
dart-bot pushed a commit that referenced this issue Aug 11, 2020
#42997

@mraleph

> Also, how to construct tests that generate AmbiguousBuilder and catch error?

Closes #42998
#42998

GitOrigin-RevId: be1aae6
Change-Id: Icdfb8f5acf7db8475a9500596b995354d2e83b3a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157941
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
@johnniwinther
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-front-end Use area-front-end for front end / CFE / kernel format related issues.
Projects
None yet
Development

No branches or pull requests

3 participants