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

type 'ForElementImpl' is not a subtype of type 'Expression' #36930

Closed
vijayawoshe opened this issue May 10, 2019 · 7 comments
Closed

type 'ForElementImpl' is not a subtype of type 'Expression' #36930

vijayawoshe opened this issue May 10, 2019 · 7 comments

Comments

@vijayawoshe
Copy link

Analyzer Feedback from IntelliJ

Version information

  • IDEA AI-183.5429.30.34.5452501
  • 2.2.1-edge.c46deebfb63c5855dc4a1674ad885bd652590914
  • AI-183.5429.30.34.5452501, JRE 1.8.0_152-release-1343-b01x64 JetBrains s.r.o, OS Mac OS X(x86_64) v10.14.4, screens 1680x1050 Retina

Exception

Dart analysis server, SDK version 2.2.1-edge.c46deebfb63c5855dc4a1674ad885bd652590914, server version 1.26.0, error: Failed to send notification
type 'ForElementImpl' is not a subtype of type 'Expression'
#0      FlutterOutlineComputer._createOutline (package:analysis_server/src/flutter/flutter_outline_computer.dart:205:42)
#1      FlutterOutlineComputer._createOutline (package:analysis_server/src/flutter/flutter_outline_computer.dart:197:23)
#2      _FlutterOutlineBuilder.visitExpression (package:analysis_server/src/flutter/flutter_outline_computer.dart:378:28)
#3      GeneralizingAstVisitor.visitInstanceCreationExpression (package:analyzer/dart/ast/visitor.dart:370:7)
#4      InstanceCreationExpressionImpl.accept (package:analyzer/src/dart/ast/ast.dart:5998:15)
#5      ReturnStatementImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:8539:18)
#6      GeneralizingAstVisitor.visitNode (package:analyzer/dart/ast/visitor.dart:438:10)
#7      GeneralizingAstVisitor.visitStatement (package:analyzer/dart/ast/visitor.dart:510:39)
#8      GeneralizingAstVisitor.visitReturnStatement (package:analyzer/dart/ast/visitor.dart:482:51)
#9      ReturnStatementImpl.accept (package:analyzer/src/dart/ast/ast.dart:8535:49)
#10     NodeListImpl.accept (package:analyzer/src/dart/ast/ast.dart:7571:20)
#11     BlockImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:1122:17)
#12     GeneralizingAstVisitor.visitNode (package:analyzer/dart/ast/visitor.dart:438:10)
#13     GeneralizingAstVisitor.visitStatement (package:analyzer/dart/ast/visitor.dart:510:39)
#14     GeneralizingAstVisitor.visitBlock (package:analyzer/dart/ast/visitor.dart:165:31)
#15     BlockImpl.accept (package:analyzer/src/dart/ast/ast.dart:1118:49)
#16     BlockFunctionBodyImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:1077:13)
#17     GeneralizingAstVisitor.visitNode (package:analyzer/dart/ast/visitor.dart:438:10)
#18     GeneralizingAstVisitor.visitFunctionBody (package:analyzer/dart/ast/visitor.dart:317:45)
#19     GeneralizingAstVisitor.visitBlockFunctionBody (package:analyzer/dart/ast/visitor.dart:168:55)
#20     BlockFunctionBodyImpl.accept (package:analyzer/src/dart/ast/ast.dart:1073:49)
#21     MethodDeclarationImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:7011:12)
#22     GeneralizingAstVisitor.visitNode (package:analyzer/dart/ast/visitor.dart:438:10)
#23     GeneralizingAstVisitor.visitAnnotatedNode (package:analyzer/dart/ast/visitor.dart:137:47)
#24     GeneralizingAstVisitor.visitDeclaration (package:analyzer/dart/ast/visitor.dart:230:43)
#25     GeneralizingAstVisitor.visitClassMember (package:analyzer/dart/ast/visitor.dart:186:43)
#26     GeneralizingAstVisitor.visitMethodDeclaration (package:analyzer/dart/ast/visitor.dart:412:55)
#27     MethodDeclarationImpl.accept (package:analyzer/src/dart/ast/ast.dart:7002:49)
#28     NodeListImpl.accept (package:analyzer/src/dart/ast/ast.dart:7571:20)
#29     ClassDeclarationImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:1591:13)
#30     GeneralizingAstVisitor.visitNode (package:analyzer/dart/ast/visitor.dart:438:10)
#31     GeneralizingAstVisitor.visitAnnotatedNode (package:analyzer/dart/ast/visitor.dart:137:47)
#32     GeneralizingAstVisitor.visitDeclaration (package:analyzer/dart/ast/visitor.dart:230:43)
#33     GeneralizingAstVisitor.visitCompilationUnitMember (package:analyzer/dart/ast/visitor.dart:205:7)
#34     GeneralizingAstVisitor.visitNamedCompilationUnitMember (package:analyzer/dart/ast/visitor.dart:423:7)
#35     GeneralizingAstVisitor.visitClassDeclaration (package:analyzer/dart/ast/visitor.dart:184:7)
#36     ClassDeclarationImpl.accept (package:analyzer/src/dart/ast/ast.dart:1561:49)
#37     NodeListImpl.accept (package:analyzer/src/dart/ast/ast.dart:7571:20)
#38     CompilationUnitImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:2173:21)
#39     GeneralizingAstVisitor.visitNode (package:analyzer/dart/ast/visitor.dart:438:10)
#40     GeneralizingAstVisitor.visitCompilationUnit (package:analyzer/dart/ast/visitor.dart:202:51)
#41     CompilationUnitImpl.accept (package:analyzer/src/dart/ast/ast.dart:2152:49)
#42     FlutterOutlineComputer.compute (package:analysis_server/src/flutter/flutter_outline_computer.dart:66:23)
#43     sendFlutterNotificationOutline.<anonymous closure> (package:analysis_server/src/flutter/flutter_notifications.dart:14:48)
#44     _sendNotification.<anonymous closure> (package:analysis_server/src/flutter/flutter_notifications.dart:31:8)
#45     _PerformanceTagImpl.makeCurrentWhile (package:analyzer/src/generated/utilities_general.dart:258:15)
#46     _sendNotification (package:analysis_server/src/flutter/flutter_notifications.dart:29:39)
#47     sendFlutterNotificationOutline (package:analysis_server/src/flutter/flutter_notifications.dart:12:3)
#48     ServerContextManagerCallbacks.addAnalysisDriver.<anonymous closure>.<anonymous closure> (package:analysis_server/src/analysis_server.dart:899:13)
#49     new Future.<anonymous closure> (dart:async/future.dart:176:37)
#50     _rootRun (dart:async/zone.dart:1120:38)
#51     _CustomZone.run (dart:async/zone.dart:1021:19)
#52     _CustomZone.runGuarded (dart:async/zone.dart:923:7)
#53     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:963:23)
#54     _rootRun (dart:async/zone.dart:1124:13)
#55     _CustomZone.run (dart:async/zone.dart:1021:19)
#56     _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:947:23)
#57     Timer._createTimer.<anonymous closure> (dart:async-patch/timer_patch.dart:21:15)
#58     _Timer._runTimers (dart:isolate-patch/timer_impl.dart:382:19)
#59     _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:416:5)
#60     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:171:12)

For additional log information, please append the contents of
file:///private/var/folders/b1/1g5tqs7557lgqt_m_ct9x3yr0000gn/T/report.txt.

@bwilkerson
Copy link
Member

Thank you for the report! This issue has been fixed in bleeding edge, and should be available the next time we publish a new dev or stable build.

@slightfoot
Copy link
Contributor

slightfoot commented May 22, 2019

@bwilkerson I've been having this same issue yet my installation identifies as Dart 2.3 but the error report says 2.2.1-edge. And, this is all about 2.3 language features which are required for the inline if, for and spread operator. So it makes sense it is identifying as a Expression in 2.2.1 because Element doesn't exist.

This actually relates to a flutter tool issue. The flutter tools ship with a dart-sdk that is 2.2.1 even though the framework/engine is compiled to release with 2.3. So tooling is using 2.2.1 but compiled and released code will use 2.3. You can test this by checkout out v1.5.8 on channel dev.

I have just run flutter upgrade on the dev channel and found that updating to Flutter 1.6.0 has resolved this bug. But the underlying issue remains. Flutter identifies as build 2.3.1-dev.0.0 a0290f823c but the version number in <flutter-sdk>\bin\cache\dart-sdk\version file states 2.3.0-edge.a0290f823c53df70643a8e46bf946020d2bbe37d

It seem's as though the packaged dart is always one version behind the framework version. Perhaps this bares looking into further.

# flutter --version
Flutter 1.6.0 • channel dev • https://github.com/flutter/flutter.git
Framework • revision ed90d05596 (8 days ago) • 2019-05-14 17:09:29 -0700
Engine • revision 832cdacc6f
Tools • Dart 2.3.1 (build 2.3.1-dev.0.0 a0290f823c)

These are all duplicates of other people having the same issue: https://github.com/dart-lang/sdk/issues?q=is%3Aissue+is%3Aopen+IfElementImpl and #36979

@slightfoot
Copy link
Contributor

@munificent @jonahwilliams I'll ping you in on this as it relates to 2.3 and tooling.

@bwilkerson
Copy link
Member

@aadilmaan For the version question.

@munificent
Copy link
Member

I think this is a weird artifact of how Flutter includes the Dart SDK. My understanding is that they pull in a commit of Dart from its bleeding edge master branch and then overwrite the version number based on the latest dev version's Git tag (which is not applied to the master branch). So you end up with a commit that claims to be a version that isn't quite what it actually is.

@vsmenon and @leafpetersen might know more.

@aadilmaan
Copy link
Contributor

Bob has properly articulated the issue. We are working to address this gap, stay tuned.

@tvolkert
Copy link
Contributor

tvolkert commented Jun 6, 2019

fwiw, the version of Dart downloaded by the Flutter tool is cut at the exact same hash as the version of Dart that's compiled into the engine. The fact that they report different product version numbers is a bug that we're working to fix, as Bob and Aadil say.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants