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: dynamic is not a subtype of dart.core::Iterable in :result #34463

Closed
alexmarkov opened this Issue Sep 13, 2018 · 10 comments

Comments

Projects
None yet
6 participants
@alexmarkov
Contributor

alexmarkov commented Sep 13, 2018

import "dart:async";

class Foo {
  Future<List<Bar>> get bars => null;

  Future<int> get boom async => (await bars)
      .map((Bar bar) => bar.value)
      .reduce((int a, int b) => a + b);
}

class Bar {
  int value;
}

main() {}
Crash when compiling null,
at character offset null:
dynamic is not a subtype of dart.core::Iterable in :result
#0      TypeEnvironment.typeError (package:kernel/type_environment.dart:103:7)
#1      Expression.getStaticTypeAsInstanceOf (package:kernel/ast.dart:2135:11)
#2      MethodInvocation.getStaticType (package:kernel/ast.dart:2744:35)
#3      AnnotateWithStaticTypes.visitMethodInvocation (package:vm/transformations/call_site_annotator.dart:76:39)
#4      MethodInvocation.accept (package:kernel/ast.dart:2773:36)
#5      VariableSet.visitChildren (package:kernel/ast.dart:2204:12)
#6      RecursiveVisitor.defaultNode (package:kernel/visitor.dart:385:10)
#7      Visitor.defaultTreeNode (package:kernel/visitor.dart:305:39)
#8      TreeVisitor.defaultExpression (package:kernel/visitor.dart:135:43)
#9      TreeVisitor.visitVariableSet (package:kernel/visitor.dart:139:43)
#10     VariableSet.accept (package:kernel/ast.dart:2200:36)
#11     ExpressionStatement.visitChildren (package:kernel/ast.dart:3604:17)
#12     RecursiveVisitor.defaultNode (package:kernel/visitor.dart:385:10)
#13     Visitor.defaultTreeNode (package:kernel/visitor.dart:305:39)
#14     TreeVisitor.defaultStatement (package:kernel/visitor.dart:186:41)
#15     TreeVisitor.visitExpressionStatement (package:kernel/visitor.dart:188:7)
#16     ExpressionStatement.accept (package:kernel/ast.dart:3600:35)
#17     visitList (package:kernel/ast.dart:5539:14)
#18     Block.visitChildren (package:kernel/ast.dart:3632:5)
#19     RecursiveVisitor.defaultNode (package:kernel/visitor.dart:385:10)
#20     Visitor.defaultTreeNode (package:kernel/visitor.dart:305:39)
#21     TreeVisitor.defaultStatement (package:kernel/visitor.dart:186:41)
#22     TreeVisitor.visitBlock (package:kernel/visitor.dart:189:31)
#23     Block.accept (package:kernel/ast.dart:3628:35)
#24     LabeledStatement.visitChildren (package:kernel/ast.dart:3735:11)
#25     RecursiveVisitor.defaultNode (package:kernel/visitor.dart:385:10)
#26     Visitor.defaultTreeNode (package:kernel/visitor.dart:305:39)
#27     TreeVisitor.defaultStatement (package:kernel/visitor.dart:186:41)
#28     TreeVisitor.visitLabeledStatement (package:kernel/visitor.dart:193:53)
#29     LabeledStatement.accept (package:kernel/ast.dart:3731:35)
#30     visitList (package:kernel/ast.dart:5539:14)
#31     Block.visitChildren (package:kernel/ast.dart:3632:5)
#32     RecursiveVisitor.defaultNode (package:kernel/visitor.dart:385:10)
#33     Visitor.defaultTreeNode (package:kernel/visitor.dart:305:39)
#34     TreeVisitor.defaultStatement (package:kernel/visitor.dart:186:41)
#35     TreeVisitor.visitBlock (package:kernel/visitor.dart:189:31)
#36     Block.accept (package:kernel/ast.dart:3628:35)
#37     TryCatch.visitChildren (package:kernel/ast.dart:4078:11)
#38     RecursiveVisitor.defaultNode (package:kernel/visitor.dart:385:10)
#39     Visitor.defaultTreeNode (package:kernel/visitor.dart:305:39)
#40     TreeVisitor.defaultStatement (package:kernel/visitor.dart:186:41)
#41     TreeVisitor.visitTryCatch (package:kernel/visitor.dart:204:37)
#42     TryCatch.accept (package:kernel/ast.dart:4074:35)
#43     FunctionNode.visitChildren (package:kernel/ast.dart:2033:11)
#44     RecursiveVisitor.defaultNode (package:kernel/visitor.dart:385:10)
#45     Visitor.defaultTreeNode (package:kernel/visitor.dart:305:39)
#46     TreeVisitor.visitFunctionNode (package:kernel/visitor.dart:242:45)
#47     FunctionNode.accept (package:kernel/ast.dart:2026:30)
#48     FunctionDeclaration.visitChildren (package:kernel/ast.dart:4374:15)
#49     RecursiveVisitor.defaultNode (package:kernel/visitor.dart:385:10)
#50     Visitor.defaultTreeNode (package:kernel/visitor.dart:305:39)
#51     TreeVisitor.defaultStatement (package:kernel/visitor.dart:186:41)
#52     TreeVisitor.visitFunctionDeclaration (package:kernel/visitor.dart:210:7)
#53     FunctionDeclaration.accept (package:kernel/ast.dart:4369:35)
#54     visitList (package:kernel/ast.dart:5539:14)
#55     Block.visitChildren (package:kernel/ast.dart:3632:5)
#56     RecursiveVisitor.defaultNode (package:kernel/visitor.dart:385:10)
#57     Visitor.defaultTreeNode (package:kernel/visitor.dart:305:39)
#58     TreeVisitor.defaultStatement (package:kernel/visitor.dart:186:41)
#59     TreeVisitor.visitBlock (package:kernel/visitor.dart:189:31)
#60     Block.accept (package:kernel/ast.dart:3628:35)
#61     FunctionNode.visitChildren (package:kernel/ast.dart:2033:11)
#62     RecursiveVisitor.defaultNode (package:kernel/visitor.dart:385:10)
#63     Visitor.defaultTreeNode (package:kernel/visitor.dart:305:39)
#64     TreeVisitor.visitFunctionNode (package:kernel/visitor.dart:242:45)
#65     FunctionNode.accept (package:kernel/ast.dart:2026:30)
#66     Procedure.visitChildren (package:kernel/ast.dart:1695:15)
#67     RecursiveVisitor.defaultNode (package:kernel/visitor.dart:385:10)
#68     Visitor.defaultTreeNode (package:kernel/visitor.dart:305:39)
#69     TreeVisitor.defaultMember (package:kernel/visitor.dart:213:35)
#70     TreeVisitor.visitProcedure (package:kernel/visitor.dart:215:39)
#71     AnnotateWithStaticTypes.visitProcedure (package:vm/transformations/call_site_annotator.dart:46:11)
#72     Procedure.accept (package:kernel/ast.dart:1688:32)
#73     visitList (package:kernel/ast.dart:5539:14)
#74     Class.visitChildren (package:kernel/ast.dart:969:5)
#75     RecursiveVisitor.defaultNode (package:kernel/visitor.dart:385:10)
#76     Visitor.defaultTreeNode (package:kernel/visitor.dart:305:39)
#77     TreeVisitor.visitClass (package:kernel/visitor.dart:222:31)
#78     Class.accept (package:kernel/ast.dart:921:30)
#79     visitList (package:kernel/ast.dart:5539:14)
#80     Library.visitChildren (package:kernel/ast.dart:416:5)
#81     RecursiveVisitor.defaultNode (package:kernel/visitor.dart:385:10)
#82     Visitor.defaultTreeNode (package:kernel/visitor.dart:305:39)
#83     TreeVisitor.visitLibrary (package:kernel/visitor.dart:236:35)
#84     List.forEach (dart:core/runtime/libgrowable_array.dart:278:8)
#85     transformLibraries (package:vm/transformations/call_site_annotator.dart:29:13)
#86     VmTarget.performModularTransformationsOnLibraries (package:vm/target/vm.dart:72:5)
#87     KernelTarget.runBuildTransformations (package:front_end/src/fasta/kernel/kernel_target.dart:782:19)
#88     KernelTarget.buildComponent.<anonymous closure> (package:front_end/src/fasta/kernel/kernel_target.dart:301:11)
<asynchronous suspension>
#89     withCrashReporting (package:front_end/src/fasta/deprecated_problems.dart:69:24)
<asynchronous suspension>
#90     KernelTarget.buildComponent (package:front_end/src/fasta/kernel/kernel_target.dart:291:12)
<asynchronous suspension>
#91     generateKernelInternal.<anonymous closure> (package:front_end/src/kernel_generator_impl.dart:150:42)
<asynchronous suspension>
#92     withCrashReporting (package:front_end/src/fasta/deprecated_problems.dart:69:24)
<asynchronous suspension>
#93     generateKernelInternal (package:front_end/src/kernel_generator_impl.dart:57:10)
<asynchronous suspension>
#94     generateKernel.<anonymous closure> (package:front_end/src/kernel_generator_impl.dart:42:18)
<asynchronous suspension>
#95     CompilerContext.runWithOptions.<anonymous closure> (package:front_end/src/fasta/compiler_context.dart:131:20)
<asynchronous suspension>
#96     CompilerContext.runInContext.<anonymous closure>.<anonymous closure> (package:front_end/src/fasta/compiler_context.dart:120:46)
#97     new Future.sync (dart:async/future.dart:224:31)
#98     CompilerContext.runInContext.<anonymous closure> (package:front_end/src/fasta/compiler_context.dart:120:19)
#99     _rootRun (dart:async/zone.dart:1124:13)
#100    _CustomZone.run (dart:async/zone.dart:1021:19)
#101    _runZoned (dart:async/zone.dart:1516:10)
#102    runZoned (dart:async/zone.dart:1463:12)
#103    CompilerContext.runInContext (package:front_end/src/fasta/compiler_context.dart:119:12)
#104    CompilerContext.runWithOptions (package:front_end/src/fasta/compiler_context.dart:129:10)
#105    generateKernel (package:front_end/src/kernel_generator_impl.dart:41:32)
<asynchronous suspension>
#106    kernelForComponent (package:front_end/src/api_prototype/kernel_generator.dart:83:17)
<asynchronous suspension>
#107    SingleShotCompilerWrapper.compileInternal (file:///usr/local/google/home/alexmarkov/work/dart/sdk/pkg/vm/bin/kernel_service.dart:186:11)
<asynchronous suspension>
#108    Compiler.compile.<anonymous closure> (file:///usr/local/google/home/alexmarkov/work/dart/sdk/pkg/vm/bin/kernel_service.dart:134:39)
#109    new Future.<anonymous closure> (dart:async/future.dart:176:37)
#110    _rootRun (dart:async/zone.dart:1120:38)
#111    _CustomZone.run (dart:async/zone.dart:1021:19)
#112    _CustomZone.runGuarded (dart:async/zone.dart:923:7)
#113    _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:963:23)
#114    _rootRun (dart:async/zone.dart:1124:13)
#115    _CustomZone.run (dart:async/zone.dart:1021:19)
#116    _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:947:23)
#117    Timer._createTimer.<anonymous closure> (dart:async/runtime/libtimer_patch.dart:21:15)
#118    _Timer._runTimers (dart:isolate/runtime/libtimer_impl.dart:382:19)
#119    _Timer._handleMessage (dart:isolate/runtime/libtimer_impl.dart:416:5)
#120    _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12)


#0      TypeEnvironment.typeError (package:kernel/type_environment.dart:103:7)
#1      Expression.getStaticTypeAsInstanceOf (package:kernel/ast.dart:2135:11)
#2      MethodInvocation.getStaticType (package:kernel/ast.dart:2744:35)
#3      AnnotateWithStaticTypes.visitMethodInvocation (package:vm/transformations/call_site_annotator.dart:76:39)
#4      MethodInvocation.accept (package:kernel/ast.dart:2773:36)
#5      VariableSet.visitChildren (package:kernel/ast.dart:2204:12)
#6      RecursiveVisitor.defaultNode (package:kernel/visitor.dart:385:10)
#7      Visitor.defaultTreeNode (package:kernel/visitor.dart:305:39)
#8      TreeVisitor.defaultExpression (package:kernel/visitor.dart:135:43)
#9      TreeVisitor.visitVariableSet (package:kernel/visitor.dart:139:43)
#10     VariableSet.accept (package:kernel/ast.dart:2200:36)
#11     ExpressionStatement.visitChildren (package:kernel/ast.dart:3604:17)
#12     RecursiveVisitor.defaultNode (package:kernel/visitor.dart:385:10)
#13     Visitor.defaultTreeNode (package:kernel/visitor.dart:305:39)
#14     TreeVisitor.defaultStatement (package:kernel/visitor.dart:186:41)
#15     TreeVisitor.visitExpressionStatement (package:kernel/visitor.dart:188:7)
#16     ExpressionStatement.accept (package:kernel/ast.dart:3600:35)
#17     visitList (package:kernel/ast.dart:5539:14)
#18     Block.visitChildren (package:kernel/ast.dart:3632:5)
#19     RecursiveVisitor.defaultNode (package:kernel/visitor.dart:385:10)
#20     Visitor.defaultTreeNode (package:kernel/visitor.dart:305:39)
#21     TreeVisitor.defaultStatement (package:kernel/visitor.dart:186:41)
#22     TreeVisitor.visitBlock (package:kernel/visitor.dart:189:31)
#23     Block.accept (package:kernel/ast.dart:3628:35)
#24     LabeledStatement.visitChildren (package:kernel/ast.dart:3735:11)
#25     RecursiveVisitor.defaultNode (package:kernel/visitor.dart:385:10)
#26     Visitor.defaultTreeNode (package:kernel/visitor.dart:305:39)
#27     TreeVisitor.defaultStatement (package:kernel/visitor.dart:186:41)
#28     TreeVisitor.visitLabeledStatement (package:kernel/visitor.dart:193:53)
#29     LabeledStatement.accept (package:kernel/ast.dart:3731:35)
#30     visitList (package:kernel/ast.dart:5539:14)
#31     Block.visitChildren (package:kernel/ast.dart:3632:5)
#32     RecursiveVisitor.defaultNode (package:kernel/visitor.dart:385:10)
#33     Visitor.defaultTreeNode (package:kernel/visitor.dart:305:39)
#34     TreeVisitor.defaultStatement (package:kernel/visitor.dart:186:41)
#35     TreeVisitor.visitBlock (package:kernel/visitor.dart:189:31)
#36     Block.accept (package:kernel/ast.dart:3628:35)
#37     TryCatch.visitChildren (package:kernel/ast.dart:4078:11)
#38     RecursiveVisitor.defaultNode (package:kernel/visitor.dart:385:10)
#39     Visitor.defaultTreeNode (package:kernel/visitor.dart:305:39)
#40     TreeVisitor.defaultStatement (package:kernel/visitor.dart:186:41)
#41     TreeVisitor.visitTryCatch (package:kernel/visitor.dart:204:37)
#42     TryCatch.accept (package:kernel/ast.dart:4074:35)
#43     FunctionNode.visitChildren (package:kernel/ast.dart:2033:11)
#44     RecursiveVisitor.defaultNode (package:kernel/visitor.dart:385:10)
#45     Visitor.defaultTreeNode (package:kernel/visitor.dart:305:39)
#46     TreeVisitor.visitFunctionNode (package:kernel/visitor.dart:242:45)
#47     FunctionNode.accept (package:kernel/ast.dart:2026:30)
#48     FunctionDeclaration.visitChildren (package:kernel/ast.dart:4374:15)
#49     RecursiveVisitor.defaultNode (package:kernel/visitor.dart:385:10)
#50     Visitor.defaultTreeNode (package:kernel/visitor.dart:305:39)
#51     TreeVisitor.defaultStatement (package:kernel/visitor.dart:186:41)
#52     TreeVisitor.visitFunctionDeclaration (package:kernel/visitor.dart:210:7)
#53     FunctionDeclaration.accept (package:kernel/ast.dart:4369:35)
#54     visitList (package:kernel/ast.dart:5539:14)
#55     Block.visitChildren (package:kernel/ast.dart:3632:5)
#56     RecursiveVisitor.defaultNode (package:kernel/visitor.dart:385:10)
#57     Visitor.defaultTreeNode (package:kernel/visitor.dart:305:39)
#58     TreeVisitor.defaultStatement (package:kernel/visitor.dart:186:41)
#59     TreeVisitor.visitBlock (package:kernel/visitor.dart:189:31)
#60     Block.accept (package:kernel/ast.dart:3628:35)
#61     FunctionNode.visitChildren (package:kernel/ast.dart:2033:11)
#62     RecursiveVisitor.defaultNode (package:kernel/visitor.dart:385:10)
#63     Visitor.defaultTreeNode (package:kernel/visitor.dart:305:39)
#64     TreeVisitor.visitFunctionNode (package:kernel/visitor.dart:242:45)
#65     FunctionNode.accept (package:kernel/ast.dart:2026:30)
#66     Procedure.visitChildren (package:kernel/ast.dart:1695:15)
#67     RecursiveVisitor.defaultNode (package:kernel/visitor.dart:385:10)
#68     Visitor.defaultTreeNode (package:kernel/visitor.dart:305:39)
#69     TreeVisitor.defaultMember (package:kernel/visitor.dart:213:35)
#70     TreeVisitor.visitProcedure (package:kernel/visitor.dart:215:39)
#71     AnnotateWithStaticTypes.visitProcedure (package:vm/transformations/call_site_annotator.dart:46:11)
#72     Procedure.accept (package:kernel/ast.dart:1688:32)
#73     visitList (package:kernel/ast.dart:5539:14)
#74     Class.visitChildren (package:kernel/ast.dart:969:5)
#75     RecursiveVisitor.defaultNode (package:kernel/visitor.dart:385:10)
#76     Visitor.defaultTreeNode (package:kernel/visitor.dart:305:39)
#77     TreeVisitor.visitClass (package:kernel/visitor.dart:222:31)
#78     Class.accept (package:kernel/ast.dart:921:30)
#79     visitList (package:kernel/ast.dart:5539:14)
#80     Library.visitChildren (package:kernel/ast.dart:416:5)
#81     RecursiveVisitor.defaultNode (package:kernel/visitor.dart:385:10)
#82     Visitor.defaultTreeNode (package:kernel/visitor.dart:305:39)
#83     TreeVisitor.visitLibrary (package:kernel/visitor.dart:236:35)
#84     List.forEach (dart:core/runtime/libgrowable_array.dart:278:8)
#85     transformLibraries (package:vm/transformations/call_site_annotator.dart:29:13)
#86     VmTarget.performModularTransformationsOnLibraries (package:vm/target/vm.dart:72:5)
#87     KernelTarget.runBuildTransformations (package:front_end/src/fasta/kernel/kernel_target.dart:782:19)
#88     KernelTarget.buildComponent.<anonymous closure> (package:front_end/src/fasta/kernel/kernel_target.dart:301:11)
<asynchronous suspension>
#89     withCrashReporting (package:front_end/src/fasta/deprecated_problems.dart:69:24)
<asynchronous suspension>
#90     KernelTarget.buildComponent (package:front_end/src/fasta/kernel/kernel_target.dart:291:12)
<asynchronous suspension>
#91     generateKernelInternal.<anonymous closure> (package:front_end/src/kernel_generator_impl.dart:150:42)
<asynchronous suspension>
#92     withCrashReporting (package:front_end/src/fasta/deprecated_problems.dart:69:24)
<asynchronous suspension>
#93     generateKernelInternal (package:front_end/src/kernel_generator_impl.dart:57:10)
<asynchronous suspension>
#94     generateKernel.<anonymous closure> (package:front_end/src/kernel_generator_impl.dart:42:18)
<asynchronous suspension>
#95     CompilerContext.runWithOptions.<anonymous closure> (package:front_end/src/fasta/compiler_context.dart:131:20)
<asynchronous suspension>
#96     CompilerContext.runInContext.<anonymous closure>.<anonymous closure> (package:front_end/src/fasta/compiler_context.dart:120:46)
#97     new Future.sync (dart:async/future.dart:224:31)
#98     CompilerContext.runInContext.<anonymous closure> (package:front_end/src/fasta/compiler_context.dart:120:19)
#99     _rootRun (dart:async/zone.dart:1124:13)
#100    _CustomZone.run (dart:async/zone.dart:1021:19)
#101    _runZoned (dart:async/zone.dart:1516:10)
#102    runZoned (dart:async/zone.dart:1463:12)
#103    CompilerContext.runInContext (package:front_end/src/fasta/compiler_context.dart:119:12)
#104    CompilerContext.runWithOptions (package:front_end/src/fasta/compiler_context.dart:129:10)
#105    generateKernel (package:front_end/src/kernel_generator_impl.dart:41:32)
<asynchronous suspension>
#106    kernelForComponent (package:front_end/src/api_prototype/kernel_generator.dart:83:17)
<asynchronous suspension>
#107    SingleShotCompilerWrapper.compileInternal (file:///usr/local/google/home/alexmarkov/work/dart/sdk/pkg/vm/bin/kernel_service.dart:186:11)
<asynchronous suspension>
#108    Compiler.compile.<anonymous closure> (file:///usr/local/google/home/alexmarkov/work/dart/sdk/pkg/vm/bin/kernel_service.dart:134:39)
#109    new Future.<anonymous closure> (dart:async/future.dart:176:37)
#110    _rootRun (dart:async/zone.dart:1120:38)
#111    _CustomZone.run (dart:async/zone.dart:1021:19)
#112    _CustomZone.runGuarded (dart:async/zone.dart:923:7)
#113    _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:963:23)
#114    _rootRun (dart:async/zone.dart:1124:13)
#115    _CustomZone.run (dart:async/zone.dart:1021:19)
#116    _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:947:23)
#117    Timer._createTimer.<anonymous closure> (dart:async/runtime/libtimer_patch.dart:21:15)
#118    _Timer._runTimers (dart:isolate/runtime/libtimer_impl.dart:382:19)
#119    _Timer._handleMessage (dart:isolate/runtime/libtimer_impl.dart:416:5)
#120    _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12)

It looks like async transformer produces kernel AST which is not strongly typed.
Then, call_site_annotator queries static type of a receiver which triggers the crash.

/cc @sjindel-google @mraleph @kmillikin @jensjoha @keertip

@keertip keertip added p0-critical and removed p1-high labels Sep 13, 2018

@a-siva a-siva added this to the Dart2.1 milestone Sep 13, 2018

@keertip

This comment has been minimized.

Show comment
Hide comment
@keertip

keertip Sep 13, 2018

Contributor

This is preventing an internal customer release, so treat as P0. If not fixed soon, we will have to rollback to -dev.0.0 internally and wait till fix to do future SDK releases.

Contributor

keertip commented Sep 13, 2018

This is preventing an internal customer release, so treat as P0. If not fixed soon, we will have to rollback to -dev.0.0 internally and wait till fix to do future SDK releases.

@mraleph mraleph self-assigned this Sep 14, 2018

dart-bot pushed a commit that referenced this issue Sep 14, 2018

[vm/kernel] Preserve strong mode types in async transformation
Async transformation uses dynamic variables in few places (e.g.
for temporaries and for incomming arguments) - which creates
not strongly typed AST with method invocations having dynamic
receivers and non-null interface targets at the same time.

To maintain strong typedness of the AST we insert unsafeCast
when accessing the temporaries.

Bug: #34463
Change-Id: I11e38c128645ebc8acb0c982a80fe4c5c4036673
Reviewed-on: https://dart-review.googlesource.com/75000
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
@mraleph

This comment has been minimized.

Show comment
Hide comment
@mraleph

mraleph Sep 14, 2018

Contributor

This should be now fixed.

Contributor

mraleph commented Sep 14, 2018

This should be now fixed.

@mraleph mraleph closed this Sep 14, 2018

@keertip

This comment has been minimized.

Show comment
Hide comment
@keertip

keertip Sep 14, 2018

Contributor

Thanks Slava! Will patch it into google3.

Contributor

keertip commented Sep 14, 2018

Thanks Slava! Will patch it into google3.

@mraleph

This comment has been minimized.

Show comment
Hide comment
@mraleph

mraleph Sep 14, 2018

Contributor

@keertip I think the fix is not correct. I am forced to revert this for now. I will land a different fix that is more robust.

Contributor

mraleph commented Sep 14, 2018

@keertip I think the fix is not correct. I am forced to revert this for now. I will land a different fix that is more robust.

@mraleph mraleph reopened this Sep 14, 2018

@keertip

This comment has been minimized.

Show comment
Hide comment
@keertip

keertip Sep 14, 2018

Contributor

ok, thanks for the update!

Contributor

keertip commented Sep 14, 2018

ok, thanks for the update!

dart-bot pushed a commit that referenced this issue Sep 15, 2018

[vm/kernel] In async transformation check if strongMode is on.
It seems we are still using non-strong mode targets in few
places (e.g. when training front-end server we by accident
train it in legacy mode).

A separate bug is filed to clean that up #34468

For now to unbreak the build we simply check if we are in the
legacy mode and then avoid using getStaticType in async
transformation.

This is followup to eec96f9.

Bug: #34463
Change-Id: Ib693fddfb9abbf89599ae646cb408d4a9c93f1b6
Reviewed-on: https://dart-review.googlesource.com/75061
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
@mraleph

This comment has been minimized.

Show comment
Hide comment
@mraleph

mraleph Sep 15, 2018

Contributor

@keertip if you cherry pick both eec96f9 and 348ed30 that should do the trick.

Contributor

mraleph commented Sep 15, 2018

@keertip if you cherry pick both eec96f9 and 348ed30 that should do the trick.

@mraleph mraleph closed this Sep 15, 2018

@keertip keertip reopened this Sep 17, 2018

@keertip

This comment has been minimized.

Show comment
Hide comment
@keertip

keertip Sep 17, 2018

Contributor

mraleph@, cherry picking the commits fixes the original issue, but am now seeing another crash in the kernel pipeline,

Unable to spawn isolate: Crash when compiling null,
at character offset null:
dynamic is not a subtype of #lib1::SelectionPO in await this.{#lib2::MobileAppPickerPO::_searchMode}()
#0 TypeEnvironment.typeError (package:kernel/type_environment.dart:103:7)
#1 Expression.getStaticTypeAsInstanceOf (package:kernel/ast.dart:2132:11)
#2 MethodInvocation.getStaticType (package:kernel/ast.dart:2741:35)
#3 AwaitExpression.getStaticType (package:kernel/ast.dart:3434:39)
#4 ExpressionLifter.assignType (package:kernel/transformations/async.dart:123:27)
#5 ExpressionLifter.visitAwaitExpression (package:kernel/transformations/async.dart:446:18)
#6 AwaitExpression.accept (package:kernel/ast.dart:3437:36)
#7 ExpressionLifter.rewrite (package:kernel/transformations/async.dart:95:36)
#8 AsyncRewriterBase.visitExpressionStatement (package:kernel/transformations/continuation.dart:414:42)
#9 ExpressionStatement.accept (package:kernel/ast.dart:3597:35)
#10 AsyncRewriterBase.visitBlock (package:kernel/transformations/continuation.dart:424:17)
#11 Block.accept (package:kernel/ast.dart:3625:35)
#12 AsyncRewriterBase.visitDelimited (package:kernel/transformations/continuation.dart:509:10)
#13 AsyncRewriterBase.buildWrappedBody (package:kernel/transformations/continuation.dart:385:24)
#14 AsyncRewriterBase.setupAsyncContinuations (package:kernel/transformations/continuation.dart:337:39)
#15 AsyncFunctionRewriter.rewrite (package:kernel/transformations/continuation.dart:1089:5)
#16 RecursiveContinuationRewriter.visitFunctionNode (package:kernel/transformations/continuation.dart:102:67)
#17 FunctionNode.accept (package:kernel/ast.dart:2023:30)
#18 Procedure.transformChildren (package:kernel/ast.dart:1698:27)
#19 Transformer.defaultTreeNode (package:kernel/visitor.dart:423:10)
#20 TreeVisitor.defaultMember (package:kernel/visitor.dart:213:35)
#21 TreeVisitor.visitProcedure (package:kernel/visitor.dart:215:39)
#22 RecursiveContinuationRewriter.visitProcedure (package:kernel/transformations/continuation.dart:77:45)
#23 Procedure.accept (package:kernel/ast.dart:1685:32)
#24 transformList (package:kernel/ast.dart:5549:27)
#25 Class.transformChildren (package:kernel/ast.dart:985:5)
#26 Transformer.defaultTreeNode (package:kernel/visitor.dart:423:10)
#27 TreeVisitor.visitClass (package:kernel/visitor.dart:222:31)
#28 Class.accept (package:kernel/ast.dart:921:30)
#29 transformList (package:kernel/ast.dart:5549:27)
#30 Library.transformChildren (package:kernel/ast.dart:426:5)
#31 Transformer.defaultTreeNode (package:kernel/visitor.dart:423:10)
#32 TreeVisitor.visitLibrary (package:kernel/visitor.dart:236:35)
#33 Library.accept (package:kernel/ast.dart:409:30)
#34 RecursiveContinuationRewriter.rewriteLibrary (package:kernel/transformations/continuation.dart:69:17)
#35 transformLibraries (package:kernel/transformations/continuation.dart:32:14)
#36 VmTarget.performModularTransformationsOnLibraries (package:vm/target/vm.dart:69:5)
#37 KernelTarget.runBuildTransformations (package:front_end/src/fasta/kernel/kernel_target.dart:787:19)
#38 KernelTarget.buildComponent. (package:front_end/src/fasta/kernel/kernel_target.dart:304:11)

see internal issue for more details.

Contributor

keertip commented Sep 17, 2018

mraleph@, cherry picking the commits fixes the original issue, but am now seeing another crash in the kernel pipeline,

Unable to spawn isolate: Crash when compiling null,
at character offset null:
dynamic is not a subtype of #lib1::SelectionPO in await this.{#lib2::MobileAppPickerPO::_searchMode}()
#0 TypeEnvironment.typeError (package:kernel/type_environment.dart:103:7)
#1 Expression.getStaticTypeAsInstanceOf (package:kernel/ast.dart:2132:11)
#2 MethodInvocation.getStaticType (package:kernel/ast.dart:2741:35)
#3 AwaitExpression.getStaticType (package:kernel/ast.dart:3434:39)
#4 ExpressionLifter.assignType (package:kernel/transformations/async.dart:123:27)
#5 ExpressionLifter.visitAwaitExpression (package:kernel/transformations/async.dart:446:18)
#6 AwaitExpression.accept (package:kernel/ast.dart:3437:36)
#7 ExpressionLifter.rewrite (package:kernel/transformations/async.dart:95:36)
#8 AsyncRewriterBase.visitExpressionStatement (package:kernel/transformations/continuation.dart:414:42)
#9 ExpressionStatement.accept (package:kernel/ast.dart:3597:35)
#10 AsyncRewriterBase.visitBlock (package:kernel/transformations/continuation.dart:424:17)
#11 Block.accept (package:kernel/ast.dart:3625:35)
#12 AsyncRewriterBase.visitDelimited (package:kernel/transformations/continuation.dart:509:10)
#13 AsyncRewriterBase.buildWrappedBody (package:kernel/transformations/continuation.dart:385:24)
#14 AsyncRewriterBase.setupAsyncContinuations (package:kernel/transformations/continuation.dart:337:39)
#15 AsyncFunctionRewriter.rewrite (package:kernel/transformations/continuation.dart:1089:5)
#16 RecursiveContinuationRewriter.visitFunctionNode (package:kernel/transformations/continuation.dart:102:67)
#17 FunctionNode.accept (package:kernel/ast.dart:2023:30)
#18 Procedure.transformChildren (package:kernel/ast.dart:1698:27)
#19 Transformer.defaultTreeNode (package:kernel/visitor.dart:423:10)
#20 TreeVisitor.defaultMember (package:kernel/visitor.dart:213:35)
#21 TreeVisitor.visitProcedure (package:kernel/visitor.dart:215:39)
#22 RecursiveContinuationRewriter.visitProcedure (package:kernel/transformations/continuation.dart:77:45)
#23 Procedure.accept (package:kernel/ast.dart:1685:32)
#24 transformList (package:kernel/ast.dart:5549:27)
#25 Class.transformChildren (package:kernel/ast.dart:985:5)
#26 Transformer.defaultTreeNode (package:kernel/visitor.dart:423:10)
#27 TreeVisitor.visitClass (package:kernel/visitor.dart:222:31)
#28 Class.accept (package:kernel/ast.dart:921:30)
#29 transformList (package:kernel/ast.dart:5549:27)
#30 Library.transformChildren (package:kernel/ast.dart:426:5)
#31 Transformer.defaultTreeNode (package:kernel/visitor.dart:423:10)
#32 TreeVisitor.visitLibrary (package:kernel/visitor.dart:236:35)
#33 Library.accept (package:kernel/ast.dart:409:30)
#34 RecursiveContinuationRewriter.rewriteLibrary (package:kernel/transformations/continuation.dart:69:17)
#35 transformLibraries (package:kernel/transformations/continuation.dart:32:14)
#36 VmTarget.performModularTransformationsOnLibraries (package:vm/target/vm.dart:69:5)
#37 KernelTarget.runBuildTransformations (package:front_end/src/fasta/kernel/kernel_target.dart:787:19)
#38 KernelTarget.buildComponent. (package:front_end/src/fasta/kernel/kernel_target.dart:304:11)

see internal issue for more details.

@alexmarkov

This comment has been minimized.

Show comment
Hide comment
@alexmarkov

alexmarkov Sep 17, 2018

Contributor

Reproducer for the new crash:

import 'dart:async';

class Lazy<T> {
  Future<T> call() => null;
}

class A {
  Lazy<B> _bar;
  
  Future<void> foo(int index) async {
    await (await _bar()).selectByIndex(index);
  }
}

class B extends C<String> {
}

abstract class C<T> {
  Future<void> selectByIndex(int index) async {
  }
}

main() {}
Contributor

alexmarkov commented Sep 17, 2018

Reproducer for the new crash:

import 'dart:async';

class Lazy<T> {
  Future<T> call() => null;
}

class A {
  Lazy<B> _bar;
  
  Future<void> foo(int index) async {
    await (await _bar()).selectByIndex(index);
  }
}

class B extends C<String> {
}

abstract class C<T> {
  Future<void> selectByIndex(int index) async {
  }
}

main() {}

@dart-bot dart-bot closed this in b6e2e15 Sep 17, 2018

@sjindel-google

This comment has been minimized.

Show comment
Hide comment
@sjindel-google

sjindel-google Sep 18, 2018

Contributor

Should we keep an issue open for the fact that the transformed kernel AST is not well typed?
It seems like this issue could pop up again in another Kernel transformation.

Contributor

sjindel-google commented Sep 18, 2018

Should we keep an issue open for the fact that the transformed kernel AST is not well typed?
It seems like this issue could pop up again in another Kernel transformation.

@kmillikin

This comment has been minimized.

Show comment
Hide comment
@kmillikin

kmillikin Sep 18, 2018

Member

We have put program transformations on our road map for 2019 (and the rest of this year; we currently have an intern working on it). It would be sweet if we could statically ensure that well-typed inputs transform to well-typed outputs.

In the meantime I think we need to make sure we are running the type checker on the output of each transformation when we run tests. That probably is something we should just do now, or else track through the issue tracker if we don't.

Member

kmillikin commented Sep 18, 2018

We have put program transformations on our road map for 2019 (and the rest of this year; we currently have an intern working on it). It would be sweet if we could statically ensure that well-typed inputs transform to well-typed outputs.

In the meantime I think we need to make sure we are running the type checker on the output of each transformation when we run tests. That probably is something we should just do now, or else track through the issue tracker if we don't.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment