Closed olesiathoms-wk closed 4 years ago
@scheglov
No, this is not expected, any code should be handled without crashes in analyzer.
Unfortunately I cannot reproduce the issue.
I cloned the repo https://github.com/davidmarne/built_redux
.
Then I run flutter analyzer
while in /Users/scheglov/dart/built_redux
:
Upgrading Flutter from /Users/scheglov/Source/flutter...
Updating cf37c2cd0..27321ebba
24 files changed, 651 insertions(+), 218 deletions(-)
Flutter is already up to date on channel stable
Flutter 1.12.13+hotfix.5 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 27321ebbad (2 weeks ago) • 2019-12-10 18:15:01 -0800
Engine • revision 2994f7e1e6
Tools • Dart 2.7.0
scheglov@scheglov-macbookpro2:~/dart/built_redux (master)$ flutter analyze
Downloading package sky_engine... 0.4s
Downloading common tools... 1.2s
Downloading common tools... 1.3s
Downloading darwin-x64 tools... 3.5s
Running "flutter pub get" in built_redux... 0.6s
Analyzing built_redux...
No issues found! (ran in 10.2s)
I also tried the bleeding edge of Dart SDK, it still can be analyzer without the Stack Overflow.
It also does not crash with the master
channel of Flutter, which is Dart 2.8.0
AFAIK.
Does the way I tried to reproduce looks right to you? Do I need a different version of built_redux
?
you should be able to reproduce it on master.
Is there a difference between flutter analyze
and dartanalyzer
?
I just tried using flutter and it worked, but at the same time dartanalyzer
fails.
~/built_redux (master ✔) ᐅ flutter analyze
Analyzing built_redux...
No issues found! (ran in 9.4s)
~/built_redux (master ✔) ᐅ dartanalyzer .
Analyzing built_redux...
Unhandled exception:
Stack Overflow
#0 new TypeParameterTypeImpl (package:analyzer/src/dart/element/type.dart:2158:3)
#1 TypeParameterTypeImpl.withNullability (package:analyzer/src/dart/element/type.dart:2265:12)
#2 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1216:19)
#3 Dart2TypeSystem._isInterfaceSubtypeOf (package:analyzer/src/generated/type_system.dart:1762:16)
#4 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1323:14)
#5 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1302:11)
#6 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1224:14)
#7 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1217:14)
#8 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1256:13)
#9 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1224:14)
#10 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1217:14)
#11 Dart2TypeSystem._isInterfaceSubtypeOf (package:analyzer/src/generated/type_system.dart:1762:16)
#12 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1323:14)
#13 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1302:11)
#14 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1224:14)
#15 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1217:14)
#16 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1256:13)
#17 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1224:14)
#18 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1217:14)
#19 Dart2TypeSystem._isInterfaceSubtypeOf (package:analyzer/src/generated/type_system.dart:1762:16)
#20 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1323:14)
#21 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1302:11)
#22 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1224:14)
#23 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1217:14)
#24 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1256:13)
#25 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1224:14)
#26 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1217:14)
#27 Dart2TypeSystem._isInterfaceSubtypeOf (package:analyzer/src/generated/type_system.dart:1762:16)
#28 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1323:14)
#29 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1302:11)
#30 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1224:14)
#31 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1217:14)
#32 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1256:13)
#33 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1224:14)
#34 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1217:14)
#35 Dart2TypeSystem._isInterfaceSubtypeOf (package:analyzer/src/generated/type_system.dart:1762:16)
#36 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1323:14)
#37 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1302:11)
#38 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1224:14)
#39 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1217:14)
#40 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1256:13)
#41 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1224:14)
#42 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1217:14)
#43 Dart2TypeSystem._isInterfaceSubtypeOf (package:analyzer/src/generated/type_system.dart:1762:16)
...
...
#6200 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1256:13)
#6201 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1224:14)
#6202 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1217:14)
#6203 Dart2TypeSystem._isInterfaceSubtypeOf (package:analyzer/src/generated/type_system.dart:1762:16)
#6204 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1323:14)
#6205 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1302:11)
#6206 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1224:14)
#6207 Dart2TypeSystem.isSubtypeOf (package:analyzer/src/generated/type_system.dart:1217:14)
#6208 _OverrideChecker._findCovariantChecksForMember.<anonymous closure> (package:analyzer/src/task/strong/checker.dart:1610:20)
#6209 FunctionTypeImpl.relateTypeFormals2 (package:analyzer/src/dart/element/type.dart:791:20)
#6210 _OverrideChecker._findCovariantChecksForMember (package:analyzer/src/task/strong/checker.dart:1606:34)
#6211 _OverrideChecker._findCovariantChecks (package:analyzer/src/task/strong/checker.dart:1538:9)
#6212 _OverrideChecker._checkForCovariantGenerics (package:analyzer/src/task/strong/checker.dart:1484:18)
#6213 _OverrideChecker.check (package:analyzer/src/task/strong/checker.dart:1420:5)
#6214 CodeChecker.visitClassDeclaration (package:analyzer/src/task/strong/checker.dart:330:22)
#6215 ClassDeclarationImpl.accept (package:analyzer/src/dart/ast/ast.dart:1522:49)
#6216 NodeListImpl.accept (package:analyzer/src/dart/ast/ast.dart:7511:20)
#6217 CompilationUnitImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:2098:21)
#6218 CodeChecker.visitCompilationUnit (package:analyzer/src/task/strong/checker.dart:351:10)
#6219 LibraryAnalyzer._computeVerifyErrors (package:analyzer/src/dart/analysis/library_analyzer.dart:380:13)
#6220 LibraryAnalyzer.analyzeSync.<anonymous closure>.<anonymous closure> (package:analyzer/src/dart/analysis/library_analyzer.dart:166:9)
#6221 _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:379:8)
#6222 LibraryAnalyzer.analyzeSync.<anonymous closure> (package:analyzer/src/dart/analysis/library_analyzer.dart:165:13)
#6223 _PerformanceTagImpl.makeCurrentWhile (package:analyzer/src/generated/utilities_general.dart:258:15)
#6224 LibraryAnalyzer.analyzeSync (package:analyzer/src/dart/analysis/library_analyzer.dart:164:34)
#6225 LibraryAnalyzer.analyze.<anonymous closure> (package:analyzer/src/dart/analysis/library_analyzer.dart:115:14)
#6226 _PerformanceTagImpl.makeCurrentWhile (package:analyzer/src/generated/utilities_general.dart:258:15)
#6227 LibraryAnalyzer.analyze (package:analyzer/src/dart/analysis/library_analyzer.dart:114:43)
#6228 AnalysisDriver._computeAnalysisResult.<anonymous closure> (package:analyzer/src/dart/analysis/driver.dart:1275:63)
#6229 PerformanceLog.run (package:analyzer/src/dart/analysis/performance_logger.dart:34:15)
#6230 AnalysisDriver._computeAnalysisResult (package:analyzer/src/dart/analysis/driver.dart:1251:20)
#6231 AnalysisDriver.getErrors (package:analyzer/src/dart/analysis/driver.dart:548:41)
#6232 _RootZone.runUnary (dart:async/zone.dart:1381:54)
#6233 _FutureListener.handleValue (dart:async/future_impl.dart:139:18)
#6234 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:680:45)
#6235 Future._propagateToListeners (dart:async/future_impl.dart:709:32)
#6236 Future._addListener.<anonymous closure> (dart:async/future_impl.dart:389:9)
#6237 _microtaskLoop (dart:async/schedule_microtask.dart:43:21)
#6238 _startMicrotaskLoop (dart:async/schedule_microtask.dart:52:5)
#6239 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:393:30)
#6240 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:418:5)
#6241 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:174:12)
#0 AnalysisDriver._computeAnalysisResult.<anonymous closure> (package:analyzer/src/dart/analysis/driver.dart:1311:9)
#1 PerformanceLog.run (package:analyzer/src/dart/analysis/performance_logger.dart:34:15)
#2 AnalysisDriver._computeAnalysisResult (package:analyzer/src/dart/analysis/driver.dart:1251:20)
#3 AnalysisDriver.getErrors (package:analyzer/src/dart/analysis/driver.dart:548:41)
<asynchronous suspension>
#4 AnalyzerImpl.prepareErrors (package:analyzer_cli/src/analyzer_impl.dart:129:58)
<asynchronous suspension>
#5 AnalyzerImpl._analyze (package:analyzer_cli/src/analyzer_impl.dart:168:11)
<asynchronous suspension>
#6 AnalyzerImpl.analyze (package:analyzer_cli/src/analyzer_impl.dart:105:18)
<asynchronous suspension>
#7 Driver._runAnalyzer (package:analyzer_cli/src/driver.dart:705:21)
#8 Driver._analyzeAllImpl (package:analyzer_cli/src/driver.dart:364:40)
<asynchronous suspension>
#9 Driver._analyzeAll (package:analyzer_cli/src/driver.dart:195:20)
<asynchronous suspension>
#10 Driver.start (package:analyzer_cli/src/driver.dart:156:38)
#11 main (file:///b/s/w/ir/cache/builder/sdk/pkg/analyzer_cli/bin/analyzer.dart:18:17)
#12 _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:303:32)
#13 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:174:12)
flutter analyze
runs Dart Analysis Server, and dartanalyzer
is a separate CLI utility. In principle there should be no difference, both use analyzer
for actual analysis, just different ways to build analysis contexts. But they might be have different versions - dartanalyzer
is probably from normal, non-Flutter Dart SDK. Please check the Dart SDK version. FWIW, this works for me:
scheglov@scheglov-macbookpro2:~/dart/built_redux (master)$ dartanalyzer --version
dartanalyzer version 2.8.0-edge.3ab95a114c6ce260f1e54752b4ebc8c322173a8a
scheglov@scheglov-macbookpro2:~/dart/built_redux (master)$ dartanalyzer .
Analyzing built_redux...
No issues found!
I was on 2.7.0
and checked 2.8.0-dev.0.0
as well, they both were failing. I just checked the same version that you are on and it's working. I'll do a little more exploring, but I think it was fixed in some commit over last two weeks
I went through commits made after 2.8.0-dev.0.0
and
Dart VM version: 2.8.0-edge.b3c2eb9f698408bca8fa35ca5cc6c6f088098ec1 (Thu Dec 12 23:54:41 2019 +0000) on "macos_x64"
introduced fix for the first time. Is it possible to release it as a patch for 2.7?
Verified that b3c2eb9f698408bca8fa35ca5cc6c6f088098ec1 does contain the fix, but it does not patch cleanly to 2.7.0. The conflict looks fairly trivial and a naive conflict resolution results in an analyzer that can at least analyze built_redux cleanly.
@bwilkerson @scheglov @jcollins-g any chance this gets patched into 2.7.x since _"the conflict looks fairly trivial and a naive conflict resolution results in an analyzer that can at least analyze builtredux cleanly."?
Or is the 2.8.0 release imminent?
This causes built_redux
, and all packages that depend on it - to not produce API documentation when dartdoc
is run using SDK version 2.7.x
w/ analyzer version 0.39.4
.
cc/ @greglittlefield-wf @md-weber @kevmoo @robbecker-wf
Is this an SDK issue or a pkg:analyzer
issue?
@kevmoo Yes to both. The report concerns the version of analyzer shipped as part of the 2.7 SDK.
CC @franklinyow @athomas
We could consider a 2.7.2 release for this.
@aaronlademann-wf – have ya'll looked at rolling to 2.8.0-dev.1.0 as an alternative?
@kevmoo I can do that locally - but that won't fix the underlying issue - which is that when a package that depends on built_redux
is published to pub.dev
, the generation of the API documentation will fail.
@kevmoo I can do that locally - but that won't fix the underlying issue - which is that when a package that depends on
built_redux
is published topub.dev
, the generation of the API documentation will fail.
Good to know. I'll work with @franklinyow on this.
Fixed in https://github.com/dart-lang/sdk/commit/b3c2eb9f698408bca8fa35ca5cc6c6f088098ec1
Will be available in the first Dart 2.8 stable release (and many recent 2.8.0-dev releases)
After updating to dart 2.7.0 in
built_redux
analysis fails with following exception:Dart 2.6.1 doesn't have this problem. Going through changes made between 2.6.1. and 2.7.0. I found out that switch to NNBD subtyping rules caused analyzer to fail https://github.com/dart-lang/sdk/commit/70b1cedd87191d11293b5d1192fada7fdbc8fc04
I think
combinedNested
functions causing this problem frombuilt_redux
side: https://github.com/davidmarne/built_redux/blob/master/lib/src/middleware.dart#L52-L61 https://github.com/davidmarne/built_redux/blob/master/lib/src/reducer_builder.dart#L31-L36 specifically extensions onBuilt
andBuilder
. Was this expected? if so, do we need to update our code to follow new rules?