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

Possible bug in the null migration tool #47363

Closed
szakarias opened this issue Oct 4, 2021 · 3 comments
Closed

Possible bug in the null migration tool #47363

szakarias opened this issue Oct 4, 2021 · 3 comments
Labels
area-migration (deprecated) Deprecated: this label is no longer actively used (was: issues with the `dart migrate` tool). type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@szakarias
Copy link
Contributor

Dart SDK version (2.15.0-154.0.dev)

Exception details:

Never.substitute(Never | {T: int?(type argument 0 of supertype of PubCommand (command.dart:48:43))}) at offset 3428 in /usr/local/google/home/zarah/pub/lib/src/command/add.dart (usageException('Must specify a package to be added.'))

#0 DecoratedType._substitute (package:nnbd_migration/src/decorated_type.dart:468:5)
#1 DecoratedType._substituteFunctionAfterFormals (package:nnbd_migration/src/decorated_type.dart:496:25)
#2 DecoratedType._substitute (package:nnbd_migration/src/decorated_type.dart:447:14)
#3 DecoratedType.substitute (package:nnbd_migration/src/decorated_type.dart:328:12)
#4 EdgeBuilder.getOrComputeElementType (package:nnbd_migration/src/edge_builder.dart:365:32)
#5 EdgeBuilder.visitMethodInvocation (package:nnbd_migration/src/edge_builder.dart:1368:20)
#6 MethodInvocationImpl.accept (package:analyzer/src/dart/ast/ast.dart:7193:50)
#7 EdgeBuilder._dispatch (package:nnbd_migration/src/edge_builder.dart:2305:24)
#8 EdgeBuilder.visitExpressionStatement (package:nnbd_migration/src/edge_builder.dart:879:25)
#9 ExpressionStatementImpl.accept (package:analyzer/src/dart/ast/ast.dart:3623:50)
#10 EdgeBuilder._dispatch (package:nnbd_migration/src/edge_builder.dart:2305:24)
#11 EdgeBuilder.visitNode (package:nnbd_migration/src/edge_builder.dart:1501:9)
#12 GeneralizingAstVisitor.visitStatement (package:analyzer/dart/ast/visitor.dart:545:40)
#13 GeneralizingAstVisitor.visitBlock (package:analyzer/dart/ast/visitor.dart:165:32)
#14 BlockImpl.accept (package:analyzer/src/dart/ast/ast.dart:1046:50)
#15 EdgeBuilder._dispatch (package:nnbd_migration/src/edge_builder.dart:2305:24)
#16 EdgeBuilder.visitIfStatement. (package:nnbd_migration/src/edge_builder.dart:1120:25)
#17 ScopedSet.doScoped (package:nnbd_migration/src/utilities/scoped_set.dart:44:13)
#18 EdgeBuilder.visitIfStatement (package:nnbd_migration/src/edge_builder.dart:1119:28)
#19 IfStatementImpl.accept (package:analyzer/src/dart/ast/ast.dart:5751:50)
#20 EdgeBuilder._dispatch (package:nnbd_migration/src/edge_builder.dart:2305:24)
#21 EdgeBuilder.visitNode (package:nnbd_migration/src/edge_builder.dart:1501:9)
#22 GeneralizingAstVisitor.visitStatement (package:analyzer/dart/ast/visitor.dart:545:40)
#23 GeneralizingAstVisitor.visitBlock (package:analyzer/dart/ast/visitor.dart:165:32)
#24 BlockImpl.accept (package:analyzer/src/dart/ast/ast.dart:1046:50)
#25 EdgeBuilder._dispatch (package:nnbd_migration/src/edge_builder.dart:2305:24)
#26 EdgeBuilder.visitNode (package:nnbd_migration/src/edge_builder.dart:1501:9)
#27 GeneralizingAstVisitor.visitFunctionBody (package:analyzer/dart/ast/visitor.dart:330:46)
#28 GeneralizingAstVisitor.visitBlockFunctionBody (package:analyzer/dart/ast/visitor.dart:168:56)
#29 BlockFunctionBodyImpl.accept (package:analyzer/src/dart/ast/ast.dart:1001:50)
#30 EdgeBuilder._dispatch (package:nnbd_migration/src/edge_builder.dart:2305:24)
#31 EdgeBuilder._handleExecutableDeclaration (package:nnbd_migration/src/edge_builder.dart:2603:7)
#32 EdgeBuilder.visitMethodDeclaration (package:nnbd_migration/src/edge_builder.dart:1327:5)
#33 MethodDeclarationImpl.accept (package:analyzer/src/dart/ast/ast.dart:7046:50)
#34 EdgeBuilder._dispatch (package:nnbd_migration/src/edge_builder.dart:2305:24)
#35 EdgeBuilder._dispatchList (package:nnbd_migration/src/edge_builder.dart:2323:7)
#36 EdgeBuilder.visitClassOrMixinOrExtensionDeclaration (package:nnbd_migration/src/edge_builder.dart:674:7)
#37 EdgeBuilder.visitClassDeclaration (package:nnbd_migration/src/edge_builder.dart:641:5)
#38 ClassDeclarationImpl.accept (package:analyzer/src/dart/ast/ast.dart:1487:50)
#39 EdgeBuilder._dispatch (package:nnbd_migration/src/edge_builder.dart:2305:24)
#40 EdgeBuilder.visitNode (package:nnbd_migration/src/edge_builder.dart:1501:9)
#41 GeneralizingAstVisitor.visitCompilationUnit (package:analyzer/dart/ast/visitor.dart:202:52)
#42 CompletenessTracker.visitCompilationUnit. (package:nnbd_migration/src/utilities/completeness_tracker.dart:52:24)
#43 PermissiveModeVisitor.reportExceptionsIfPermissive (package:nnbd_migration/src/utilities/permissive_mode.dart:26:24)
#44 CompletenessTracker.visitCompilationUnit (package:nnbd_migration/src/utilities/completeness_tracker.dart:43:5)
#45 CompilationUnitImpl.accept (package:analyzer/src/dart/ast/ast.dart:2076:50)
#46 NullabilityMigrationImpl.processInput (package:nnbd_migration/src/nullability_migration_impl.dart:231:12)
#47 NonNullableFix.processUnit (package:nnbd_migration/src/front_end/non_nullable_fix.dart:164:16)
#48 _FixCodeProcessor.runLaterPhases. (package:nnbd_migration/migration_cli.dart:1092:20)
#49 _FixCodeProcessor.runLaterPhases. (package:nnbd_migration/migration_cli.dart:1090:28)
#50 _FixCodeProcessor.processResources (package:nnbd_migration/migration_cli.dart:1024:26)

#51 _FixCodeProcessor.runLaterPhases (package:nnbd_migration/migration_cli.dart:1090:5)

#52 MigrationCliRunner.run (package:nnbd_migration/migration_cli.dart:697:24)

#53 MigrateCommand.run (package:dartdev/src/commands/migrate.dart:37:7)

#54 CommandRunner.runCommand (package:args/command_runner.dart:209:13)

#55 DartdevRunner.runCommand (package:dartdev/dartdev.dart:223:18)

#56 runDartdev (package:dartdev/dartdev.dart:66:16)

#57 main (file:///b/s/w/ir/cache/builder/sdk/pkg/dartdev/bin/dartdev.dart:11:3)

@lrhn lrhn added area-migration (deprecated) Deprecated: this label is no longer actively used (was: issues with the `dart migrate` tool). type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) labels Oct 5, 2021
@robbecker-wf
Copy link

I am also seeing this same exception when running the migration tool. The good news is it's reproducible in a public repo https://github.com/Workiva/webdev_proxy. This happens with Dart versions of 2.12.4 up to 2.18.7.

I suspect it may have to do with the version of analyzer? The project recently had dependencies updated to allow analyzer version >= 1. In webdev_proxy 0.1.7 analyzer resolved to 0.41.2 and in 0.1.8 and master it resolves to 1.7.2.

Never.substitute(Never | {T: int?(type argument 0 of supertype of ServeCommand (serve_command.dart:35:36))}) at offset 3969 in /Users/robbecker/code/webdev_proxy/lib/src/serve_command.dart (usageException)

#0      DecoratedType._substitute (package:nnbd_migration/src/decorated_type.dart:472:5)
#1      DecoratedType._substituteFunctionAfterFormals (package:nnbd_migration/src/decorated_type.dart:500:25)
#2      DecoratedType._substitute (package:nnbd_migration/src/decorated_type.dart:451:14)
#3      DecoratedType.substitute (package:nnbd_migration/src/decorated_type.dart:332:12)
#4      EdgeBuilder.getOrComputeElementType (package:nnbd_migration/src/edge_builder.dart:378:32)
#5      EdgeBuilder.visitSimpleIdentifier (package:nnbd_migration/src/edge_builder.dart:1801:11)
#6      SimpleIdentifierImpl.accept (package:analyzer/src/dart/ast/ast.dart:9867:50)
#7      EdgeBuilder._dispatch (package:nnbd_migration/src/edge_builder.dart:2341:24)
#8      EdgeBuilder._handleAssignment (package:nnbd_migration/src/edge_builder.dart:2470:20)
#9      EdgeBuilder._handleInvocationArguments (package:nnbd_migration/src/edge_builder.dart:3086:7)
#10     EdgeBuilder.visitMethodInvocation (package:nnbd_migration/src/edge_builder.dart:1417:24)
#11     MethodInvocationImpl.accept (package:analyzer/src/dart/ast/ast.dart:7912:50)
#12     EdgeBuilder._dispatch (package:nnbd_migration/src/edge_builder.dart:2341:24)
#13     EdgeBuilder.visitExpressionStatement (package:nnbd_migration/src/edge_builder.dart:895:25)
#14     ExpressionStatementImpl.accept (package:analyzer/src/dart/ast/ast.dart:4065:50)
#15     EdgeBuilder._dispatch (package:nnbd_migration/src/edge_builder.dart:2341:24)
#16     EdgeBuilder.visitNode (package:nnbd_migration/src/edge_builder.dart:1537:9)
#17     GeneralizingAstVisitor.visitStatement (package:analyzer/dart/ast/visitor.dart:560:40)
#18     GeneralizingAstVisitor.visitBlock (package:analyzer/dart/ast/visitor.dart:167:32)
#19     BlockImpl.accept (package:analyzer/src/dart/ast/ast.dart:1183:50)
#20     EdgeBuilder._dispatch (package:nnbd_migration/src/edge_builder.dart:2341:24)
#21     EdgeBuilder.visitNode (package:nnbd_migration/src/edge_builder.dart:1537:9)
#22     GeneralizingAstVisitor.visitFunctionBody (package:analyzer/dart/ast/visitor.dart:338:46)
#23     GeneralizingAstVisitor.visitBlockFunctionBody (package:analyzer/dart/ast/visitor.dart:170:56)
#24     BlockFunctionBodyImpl.accept (package:analyzer/src/dart/ast/ast.dart:1134:50)
#25     EdgeBuilder._dispatch (package:nnbd_migration/src/edge_builder.dart:2341:24)
#26     EdgeBuilder._handleExecutableDeclaration (package:nnbd_migration/src/edge_builder.dart:2637:7)
#27     EdgeBuilder.visitMethodDeclaration (package:nnbd_migration/src/edge_builder.dart:1363:5)
#28     MethodDeclarationImpl.accept (package:analyzer/src/dart/ast/ast.dart:7764:50)
#29     EdgeBuilder._dispatch (package:nnbd_migration/src/edge_builder.dart:2341:24)
#30     EdgeBuilder._dispatchList (package:nnbd_migration/src/edge_builder.dart:2359:7)
#31     EdgeBuilder.visitClassOrMixinOrExtensionDeclaration (package:nnbd_migration/src/edge_builder.dart:690:7)
#32     EdgeBuilder.visitClassDeclaration (package:nnbd_migration/src/edge_builder.dart:657:5)
#33     ClassDeclarationImpl.accept (package:analyzer/src/dart/ast/ast.dart:1698:50)
#34     EdgeBuilder._dispatch (package:nnbd_migration/src/edge_builder.dart:2341:24)
#35     EdgeBuilder.visitNode (package:nnbd_migration/src/edge_builder.dart:1537:9)
#36     GeneralizingAstVisitor.visitCompilationUnit (package:analyzer/dart/ast/visitor.dart:204:52)
#37     CompletenessTracker.visitCompilationUnit.<anonymous closure> (package:nnbd_migration/src/utilities/completeness_tracker.dart:52:24)
#38     PermissiveModeVisitor.reportExceptionsIfPermissive (package:nnbd_migration/src/utilities/permissive_mode.dart:26:24)
#39     CompletenessTracker.visitCompilationUnit (package:nnbd_migration/src/utilities/completeness_tracker.dart:43:5)
#40     CompilationUnitImpl.accept (package:analyzer/src/dart/ast/ast.dart:2310:50)
#41     NullabilityMigrationImpl.processInput (package:nnbd_migration/src/nullability_migration_impl.dart:223:12)
#42     NonNullableFix.processUnit (package:nnbd_migration/src/front_end/non_nullable_fix.dart:162:16)
#43     _FixCodeProcessor.runLaterPhases.<anonymous closure> (package:nnbd_migration/migration_cli.dart:1088:20)
#44     _FixCodeProcessor.processResources (package:nnbd_migration/migration_cli.dart:1020:26)
<asynchronous suspension>
#45     _FixCodeProcessor.runLaterPhases (package:nnbd_migration/migration_cli.dart:1086:5)
<asynchronous suspension>
#46     MigrationCliRunner.run (package:nnbd_migration/migration_cli.dart:695:24)
<asynchronous suspension>
#47     MigrateCommand.run (package:dartdev/src/commands/migrate.dart:37:7)
<asynchronous suspension>
#48     CommandRunner.runCommand (package:args/command_runner.dart:209:13)
<asynchronous suspension>
#49     DartdevRunner.runCommand (package:dartdev/dartdev.dart:231:18)
<asynchronous suspension>
#50     runDartdev (package:dartdev/dartdev.dart:66:16)
<asynchronous suspension>
#51     main (file:///opt/s/w/ir/x/w/sdk/pkg/dartdev/bin/dartdev.dart:11:3)
<asynchronous suspension>

@robbecker-wf
Copy link

Update: it seems that adding --ignore-errors bypasses this exception/crash and then the migration tool appears to work. I just hope it's not doing something differently or wrong because we're ignoring errors.

@stereotype441
Copy link
Member

As of 1c7fe71, the null safety migration tool has been removed from active development and retired. No further work on the tool is planned.

If you still need help, or you believe this issue has been closed in error, please feel free to reopen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-migration (deprecated) Deprecated: this label is no longer actively used (was: issues with the `dart migrate` tool). type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

4 participants