dart-lang / sdk

The Dart SDK, including the VM, JS and Wasm compilers, analysis, core libraries, and more.
https://dart.dev
BSD 3-Clause "New" or "Revised" License
10.11k stars 1.56k forks source link

analysis server exception - 'DynamicTypeImpl' is not a subtype of type 'InterfaceType' in TypeProviderForLink._buildInterfaceType #35437

Closed RajithaAppit closed 4 years ago

RajithaAppit commented 5 years ago

Analyzer Feedback from IntelliJ

Version information

Exception

Please append the contents of: file://C:\Users\welcome\AppData\Local\Temp\report1.txt


Dart analysis server, SDK version 2.1.0-dev.9.4, server version 1.21.1, error: Analysis failed: F:\flutter\flutter_app\lib\list.dart context: exception_20181218_130522_035
type 'DynamicTypeImpl' is not a subtype of type 'InterfaceType'
#0      TypeProviderForLink._buildInterfaceType (package:analyzer/src/summary/link.dart:5428:5)
#1      TypeProviderForLink.listType (package:analyzer/src/summary/link.dart:5375:21)
#2      StaticTypeAnalyzer.visitListLiteral (package:analyzer/src/generated/static_type_analyzer.dart:622:23)
#3      ListLiteralImpl.accept (package:analyzer/src/dart/ast/ast.dart:7314:49)
#4      ResolverVisitor.visitNode (package:analyzer/src/generated/resolver.dart:5264:10)
#5      UnifyingAstVisitor.visitListLiteral (package:analyzer/dart/ast/visitor.dart:3142:43)
#6      ResolverVisitor.visitListLiteral (package:analyzer/src/generated/resolver.dart:5160:11)
#7      ListLiteralImpl.accept (package:analyzer/src/dart/ast/ast.dart:7314:49)
#8      ExprTypeComputer.compute (package:analyzer/src/summary/link.dart:2521:16)
#9      TypeInferenceNode.evaluate (package:analyzer/src/summary/link.dart:5265:36)
#10     TypeInferenceDependencyWalker.evaluate (package:analyzer/src/summary/link.dart:5117:7)
#11     DependencyWalker.walk.strongConnect (package:analyzer/src/summary/link.dart:2199:13)
#12     DependencyWalker.walk (package:analyzer/src/summary/link.dart:2218:18)
#13     VariableElementForLink.inferredType (package:analyzer/src/summary/link.dart:5526:47)
stereotype441 commented 5 years ago

This bug has occurred at least two other times (see also #34576 and #34898). Previously we closed it based on the assumption that the user was doing something weird (like upgrading Flutter) that caused the Dart SDK to disappear. But I think we need to gather more information to figure out definitively what's happening. We should add some instrumentation logic tracking information like:

And we should add code to TypeProviderForLink._buildInterfaceType to dump out this info in the event that the failure occurs again.

mindon commented 5 years ago

facing the same exception when building fuchsia os

`/usr/bin/env ../../build/dart/run_analysis.py --source-file /root/source/fuchsia/out/x64/dartlang/gen/topaz/app/spinning_cube/spinning_cube_dart_library.sources --dot-packages /root/source/fuchsia/out/x64/dartlang/gen/topaz/app/spinning_cube/spinning_cube_dart_library.packages --dartanalyzer /root/source/fuchsia/topaz/tools/prebuilt-dart-sdk/linux-x64/bin/dartanalyzer --dart-sdk /root/source/fuchsia/topaz/tools/prebuilt-dart-sdk/linux-x64 --options /root/source/fuchsia/topaz/app/spinning_cube/analysis_options.yaml --stamp /root/source/fuchsia/out/x64/dartlang/gen/topaz/app/spinning_cube/spinning_cube_dart_library_analysis.analyzed --depname dartlang/gen/topaz/app/spinning_cube/spinning_cube_dart_library_analysis.analyzed --depfile /root/source/fuchsia/out/x64/dartlang/gen/topaz/app/spinning_cube/spinning_cube_dart_library_analysis.analysis.d

Analyzing /root/source/fuchsia/topaz/app/spinning_cube/lib/spinning_cube_gem.dart, /root/source/fuchsia/topaz/app/spinning_cube/lib/main.dart... Unhandled exception:

type 'DynamicTypeImpl' is not a subtype of type 'InterfaceType'

0 TypeProviderForLink._buildInterfaceType (package:analyzer/src/summary/link.dart:5428:5) 1 TypeProviderForLink.objectType (package:analyzer/src/summary/link.dart:5397:23) 2 ClassElementForLink_Class._computeInterfaceType (package:analyzer/src/summary/link.dart:928:67) 3 ClassElementForLink_Class.supertype (package:analyzer/src/summary/link.dart:826:27) 4 InstanceMemberInferrer._inferClass (package:analyzer/src/task/strong_mode.dart:294:33) 5 InstanceMemberInferrer._inferClasses (package:analyzer/src/task/strong_mode.dart:326:9) 6 InstanceMemberInferrer.inferCompilationUnit (package:analyzer/src/task/strong_mode.dart:55:5) 7 CompilationUnitElementInBuildUnit.link (package:analyzer/src/summary/link.dart:1622:7) 8 LibraryElementInBuildUnit.link (package:analyzer/src/summary/link.dart:3780:12) 9 LibraryCycleNode.link (package:analyzer/src/summary/link.dart:3486:15) 10 LibraryCycleDependencyWalker.evaluate (package:analyzer/src/summary/link.dart:3426:7) 11 DependencyWalker.walk.strongConnect (package:analyzer/src/summary/link.dart:2199:13) 12 DependencyWalker.walk.strongConnect (package:analyzer/src/summary/link.dart:2165:24) 13 DependencyWalker.walk.strongConnect (package:analyzer/src/summary/link.dart:2165:24) 14 DependencyWalker.walk.strongConnect (package:analyzer/src/summary/link.dart:2165:24) 15 DependencyWalker.walk.strongConnect (package:analyzer/src/summary/link.dart:2165:24) 16 DependencyWalker.walk (package:analyzer/src/summary/link.dart:2218:18) 17 LibraryCycleForLink.ensureLinked (package:analyzer/src/summary/link.dart:3459:42) 18 Linker.link (package:analyzer/src/summary/link.dart:3982:35) 19 _relink (package:analyzer/src/summary/link.dart:302:57) 20 link (package:analyzer/src/summary/link.dart:120:3) 21 new LibraryContext.forSingleLibrary.. (package:analyzer/src/dart/analysis/library_context.dart:118:27) 22 PerformanceLog.run (package:analyzer/src/dart/analysis/performance_logger.dart:34:15) 23 new LibraryContext.forSingleLibrary. (package:analyzer/src/dart/analysis/library_context.dart:117:14) 24 PerformanceLog.run (package:analyzer/src/dart/analysis/performance_logger.dart:34:15) 25 new LibraryContext.forSingleLibrary (package:analyzer/src/dart/analysis/library_context.dart:56:19) 26 AnalysisDriver._createLibraryContext (package:analyzer/src/dart/analysis/driver.dart:1374:16) 27 AnalysisDriver._computeUnitElement (package:analyzer/src/dart/analysis/driver.dart:1316:43) 28 AnalysisDriver.performWork (package:analyzer/src/dart/analysis/driver.dart:971:40) 29 AnalysisDriverScheduler._run (package:analyzer/src/dart/analysis/driver.dart:1891:24) 30 AnalysisDriverScheduler.start (package:analyzer/src/dart/analysis/driver.dart:1832:5) 31 Driver._createContextAndAnalyze (package:analyzer_cli/src/driver.dart:658:15) 32 Driver._analyzeAllImpl (package:analyzer_cli/src/driver.dart:328:9) 33 Driver._analyzeAll (package:analyzer_cli/src/driver.dart:258:20) 34 Driver.start (package:analyzer_cli/src/driver.dart:209:38) 35 main (file:///b/s/w/ir/kitchen-workdir/dart/sdk/pkg/analyzer_cli/bin/analyzer.dart:17:17) 36 _startIsolate. (dart:isolate/runtime/libisolate_patch.dart:285:32) 37 _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12)`

srawlins commented 5 years ago

Note that this was reported as recently as Dart 2.4.0.

MarcelGarus commented 4 years ago

Any updates on this? Also, for reproducibility, here's a Travis build that causes the same error: https://travis-ci.com/schul-cloud/schulcloud-flutter/builds/131689054

scheglov commented 4 years ago

Can you upgrade to latest analyzer, i.e. 0.38.5 currently? The exception in this issue is from the previous implementation of analyzer summaries, which was recently replaced with a new one.

If it still fails, it would be very useful if there were a way for me to reproduce the issue locally. Then I could debug it and fix any analyzer problem.

MarcelGarus commented 4 years ago

Did that and it works, thank you 😄 A quick side note: Because we use the stable channel, flutter_test: any requires analyzer: <0.37.0. We didn't write any tests yet, so I was able to ditch the dependency but it's a bit ironic that our CI works now because of removing the flutter_test dependency.

scheglov commented 4 years ago

Hm... It does not look that flutter_test depends on analyzer. I tried also the stable channel, it also does not use analyzer.

scheglov commented 4 years ago

We removed summary1, this issue is stale.