Skip to content

Optional new and const crash during compilation on Flutter 0.2.7-pre.6 #32737

Closed
@timsneath

Description

@timsneath

My code is here:
https://github.com/flutter/flutter_attract/tree/dart2

(original code without optional new and const is in the master branch).

Crash:

[C:\git\flutter_attract] flutter run
Using hardware rendering with device Android SDK built for x86. If you get graphics artifacts, consider enabling software rendering with "--enable-software-rendering".
Launching lib/main.dart on Android SDK built for x86 in debug mode...
Initializing gradle...                                       0.9s
Resolving dependencies...                                    1.0s
Running 'gradlew assembleDebug'...
compiler message: lib/main.dart:105:26: Error: The keyword 'const' or 'new' is required here. Due to an implementation limit, the compiler isn't able to
infer 'const' or 'new' here.
compiler message:                   style: TextStyle(
compiler message:                          ^
compiler message: Unhandled exception:
Crash when compiling file:///C:/git/flutter_attract/lib/main.dart,
at character offset 2237:
lib/main.dart:105:26: Internal problem: Unhandled invalid-expression "lib/main.dart:105:26: Error: The keyword 'const' or 'new' is required here. Due to
an implementation limit, the compiler isn't able to infer 'const' or 'new' here.\n                  style: TextStyle(\n                         ^" in defaultTreeNode.
                  style: TextStyle(
                         ^
#0      internalProblem (package:front_end/src/fasta/problems.dart:30)
#1      unhandled (package:front_end/src/fasta/problems.dart:43)
#2      ConstnessEvaluator.defaultTreeNode (package:front_end/src/fasta/kernel/constness_evaluator.dart:112)
#3      TreeVisitor.defaultExpression (package:kernel/visitor.dart:140)
#4      TreeVisitor.visitInvalidExpression (package:kernel/visitor.dart:142)
#5      InvalidExpression.accept (package:kernel/ast.dart:2121)
#6      ConstnessEvaluator.visitConstructorInvocation (package:front_end/src/fasta/kernel/constness_evaluator.dart:175)
#7      ConstructorInvocation.accept (package:kernel/ast.dart:2983)
#8      ConstnessEvaluator.evaluate (package:front_end/src/fasta/kernel/constness_evaluator.dart:99)
#9      evaluateConstness (package:front_end/src/fasta/kernel/constness_evaluator.dart:466)
#10     BodyBuilder.inferConstness (package:front_end/src/fasta/kernel/body_builder.dart:710)
#11     BodyBuilder.finishFunction (package:front_end/src/fasta/kernel/body_builder.dart:697)
#12     DietListener.listenerFinishFunction (package:front_end/src/fasta/source/diet_listener.dart:684)
#13     DietListener.parseFunctionBody (package:front_end/src/fasta/source/diet_listener.dart:718)
#14     DietListener.buildFunctionBody (package:front_end/src/fasta/source/diet_listener.dart:565)
#15     DietListener.endMethod (package:front_end/src/fasta/source/diet_listener.dart:530)
#16     Parser.parseMethod (package:front_end/src/fasta/parser/parser.dart:3796)
#17     Parser.parseClassMemberImpl (package:front_end/src/fasta/parser/parser.dart:3670)
#18     Parser.parseClassBody (package:front_end/src/fasta/parser/parser.dart:3467)
#19     Parser.parseClass (package:front_end/src/fasta/parser/parser.dart:1699)
#20     Parser.parseClassOrNamedMixinApplication (package:front_end/src/fasta/parser/parser.dart:1659)
#21     Parser.parseTopLevelKeywordDeclaration (package:front_end/src/fasta/parser/parser.dart:535)
#22     Parser.parseTopLevelDeclarationImpl (package:front_end/src/fasta/parser/parser.dart:451)
#23     Parser.parseUnit (package:front_end/src/fasta/parser/parser.dart:335)
#24     SourceLoader.buildBody (package:front_end/src/fasta/source/source_loader.dart:198)
<asynchronous suspension>
#25     Loader.buildBodies (package:front_end/src/fasta/loader.dart:157)
<asynchronous suspension>
#26     KernelTarget.buildComponent (package:front_end/src/fasta/kernel/kernel_target.dart:292)
<asynchronous suspension>
#27     IncrementalCompiler.computeDelta.<anonymous closure> (package:front_end/src/fasta/incremental_compiler.dart:140)
<asynchronous suspension>
#28     CompilerContext.runInContext.<anonymous closure> (package:front_end/src/fasta/compiler_context.dart:105)
#29     _rootRun (dart:async/zone.dart:1126)
#30     _CustomZone.run (dart:async/zone.dart:1023)
#31     runZoned (dart:async/zone.dart:1501)
#32     CompilerContext.runInContext (package:front_end/src/fasta/compiler_context.dart:105)
#33     IncrementalCompiler.computeDelta (package:front_end/src/fasta/incremental_compiler.dart:61)
<asynchronous suspension>
#34     IncrementalCompiler.compile (package:vm/incremental_compiler.dart:33)
<asynchronous suspension>
#35     FrontendCompiler.compile.<anonymous closure> (package:vm/frontend_server.dart:254)
#36     new Future.<anonymous closure> (dart:async/future.dart:174)
#37     _rootRun (dart:async/zone.dart:1122)
#38     _CustomZone.run (dart:async/zone.dart:1023)
#39     _CustomZone.runGuarded (dart:async/zone.dart:925)
#40     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:965)
#4
compiler message: 1     _rootRun (dart:async/zone.dart:1126)
#42     _CustomZone.run (dart:async/zone.dart:1023)
#43     _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:949)
#44     Timer._createTimer.<anonymous closure> (dart:async-patch/dart:async/timer_patch.dart:21)
#45     _Timer._runTimers (dart:isolate-patch/dart:isolate/timer_impl.dart:382)
#46     _Timer._handleMessage (dart:isolate-patch/dart:isolate/timer_impl.dart:416)
#47     _RawReceivePortImpl._handleMessage (dart:isolate-patch/dart:isolate/isolate_patch.dart:165)


#0      internalProblem (package:front_end/src/fasta/problems.dart:30)
#1      unhandled (package:front_end/src/fasta/problems.dart:43)
#2      ConstnessEvaluator.defaultTreeNode (package:front_end/src/fasta/kernel/constness_evaluator.dart:112)
#3      TreeVisitor.defaultExpression (package:kernel/visitor.dart:140)
#4      TreeVisitor.visitInvalidExpression (package:kernel/visitor.dart:142)
#5      InvalidExpression.accept (package:kernel/ast.dart:2121)
#6      ConstnessEvaluator.visitConstructorInvocation (package:front_end/src/fasta/kernel/constness_evaluator.dart:175)
#7      ConstructorInvocation.accept (package:kernel/ast.dart:2983)
#8      ConstnessEvaluator.evaluate (package:front_end/src/fasta/kernel/constness_evaluator.dart:99)
#9      evaluateConstness (package:front_end/src/fasta/kernel/constness_evaluator.dart:466)
#10     BodyBuilder.inferConstness (package:front_end/src/fasta/kernel/body_builder.dart:710)
#11     BodyBuilder.finishFunction (package:front_end/src/fasta/kernel/body_builder.dart:697)
#12     DietListener.listenerFinishFunction (package:front_end/src/fasta/source/diet_listener.dart:684)
#13     DietListener.parseFunctionBody (package:front_end/src/fasta/source/diet_listener.dart:718)
#14     DietListener.buildFunctionBody (package:front_end/src/fasta/source/diet_listener.dart:565)
#15     DietListener.endMethod (package:front_end/src/fasta/source/diet_listener.dart:530)
#16     Parser.parseMethod (package:front_end/src/fasta/parser/parser.dart:3796)
#17     Parser.parseClassMemberImpl (package:front_end/src/fasta/parser/parser.dart:3670)
#18     Parser.parseClassBody (package:front_end/src/fasta/parser/parser.dart:3467)
#19     Parser.parseClass (package:front_end/src/fasta/parser/parser.dart:1699)
#20     Parser.parseClassOrNamedMixinApplication (package:front_end/src/fasta/parser/parser.dart:1659)
#21     Parser.parseTopLevelKeywordDeclaration (package:front_end/src/fasta/parser/parser.dart:535)
#22     Parser.parseTopLevelDeclarationImpl (package:front_end/src/fasta/parser/parser.dart:451)
#23     Parser.parseUnit (package:front_end/src/fasta/parser/parser.dart:335)
#24     SourceLoader.buildBody (package:front_end/src/fasta/source/source_loader.dart:198)
<asynchronous suspension>
#25     Loader.buildBodies (package:front_end/src/fasta/loader.dart:157)
<asynchronous suspension>
#26     KernelTarget.buildComponent (package:front_end/src/fasta/kernel/kernel_target.dart:292)
<asynchronous suspension>
#27     IncrementalCompiler.computeDelta.<anonymous closure> (package:front_end/src/fasta/incremental_compiler.dart:140)
<asynchronous suspension>
#28     CompilerContext.runInContext.<anonymous closure> (package:front_end/src/fasta/compiler_context.dart:105)
#29     _rootRun (dart:async/zone.dart:1126)
#30     _CustomZone.run (dart:async/zone.dart:1023)
#31     runZoned (dart:async/zone.dart:1501)
#32     CompilerContext.runInContext (package:front_end/src/fasta/compiler_context.dart:105)
#33     IncrementalCompiler.computeDelta (package:front_end/src/fasta/incremental_compiler.dart:61)
<asynchronous suspension>
#34     IncrementalCompiler.compile (package:vm/incremental_compiler.dart:33)
<asynchronous suspension>
#35     FrontendCompiler.compile.<anonymous closure> (package:vm/frontend_server.dart:254)
#36     new Future.<anonymous closure> (dart:async/future.dart:174)
#37     _rootRun (dart:async/zone.dart:1122)
#38     _CustomZone.run (dart:async/zone.dart:1023)
#39     _CustomZone.runGuarded (dart:async/zone.dart:925)
#40     _CustomZone.bindCallbackGuarded.<anonymo
compiler message: us closure> (dart:async/zone.dart:965)
#41     _rootRun (dart:async/zone.dart:1126)
#42     _CustomZone.run (dart:async/zone.dart:1023)
#43     _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:949)
#44     Timer._createTimer.<anonymous closure> (dart:async-patch/dart:async/timer_patch.dart:21)
#45     _Timer._runTimers (dart:isolate-patch/dart:isolate/timer_impl.dart:382)
#46     _Timer._handleMessage (dart:isolate-patch/dart:isolate/timer_impl.dart:416)
#47     _RawReceivePortImpl._handleMessage (dart:isolate-patch/dart:isolate/isolate_patch.dart:165)

Compiler terminated unexpectedly on C:\git\flutter_attract\lib/main.dart

FAILURE: Build failed with an exception.

* Where:
Script 'C:\git\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 441

* What went wrong:
Execution failed for task ':app:flutterBuildDebug'.
> Process 'command 'C:\git\flutter\bin\flutter.bat'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org

BUILD FAILED in 4s
Gradle build failed: 1

[C:\git\flutter_attract]

Flutter doctor output:

[C:\git\flutter_attract] flutter doctor -v
[√] Flutter (Channel master, v0.2.7-pre.6, on Microsoft Windows [Version 10.0.14393], locale en-US)
    • Flutter version 0.2.7-pre.6 at c:\git\flutter
    • Framework revision 0c89920069 (17 hours ago), 2018-04-01 17:35:05 -0700
    • Engine revision c903c217a1
    • Dart version 2.0.0-dev.43.0.flutter-52afcba357

[√] Android toolchain - develop for Android devices (Android SDK 27.0.3)
    • Android SDK at C:\Users\timsneath\AppData\Local\Android\sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-27, build-tools 27.0.3
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)
    • All Android licenses accepted.

[√] Android Studio (version 3.1)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)

[√] VS Code, 64-bit edition (version 1.21.1)
    • VS Code at C:\Program Files\Microsoft VS Code
    • Dart Code extension version 2.11.1

[√] Connected devices (1 available)
    • Android SDK built for x86 • emulator-5554 • android-x86 • Android 8.1.0 (API 27) (emulator)

Metadata

Metadata

Labels

P0A serious issue requiring immediate resolutioncrashProcess exits with SIGSEGV, SIGABRT, etc. An unhandled exception is not a crash.legacy-area-front-endLegacy: Use area-dart-model instead.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions