Skip to content

Dart format cannot format file with extension type in it #53604

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

Closed
srawlins opened this issue Sep 25, 2023 · 1 comment
Closed

Dart format cannot format file with extension type in it #53604

srawlins opened this issue Sep 25, 2023 · 1 comment
Labels
closed-duplicate Closed in favor of an existing report

Comments

@srawlins
Copy link
Member

I get this when using dart format with a dart compiled from HEAD today:

$ xcodebuild/ReleaseX64/dart-sdk/bin/dart format --enable-experiment=inline-class pkg/analysis_server/test/verify_error_fix_status_test2.dart
Hit a bug in the formatter when formatting pkg/analysis_server/test/verify_error_fix_status_test2.dart.
Please report at github.com/dart-lang/dart_style/issues.
Exception: Missing implementation of visitExtensionTypeDeclaration
#0      ThrowingAstVisitor._throw (package:analyzer/dart/ast/visitor.dart:2911:5)
#1      ThrowingAstVisitor.visitExtensionTypeDeclaration (package:analyzer/dart/ast/visitor.dart:2526:7)
#2      ExtensionTypeDeclarationImpl.accept (package:analyzer/src/dart/ast/ast.dart:6847:20)
#3      SourceVisitor.visit (package:dart_style/src/source_visitor.dart:3099:10)
#4      SourceVisitor.visitCompilationUnit (package:dart_style/src/source_visitor.dart:668:7)
#5      CompilationUnitImpl.accept (package:analyzer/src/dart/ast/ast.dart:3650:50)
#6      SourceVisitor.visit (package:dart_style/src/source_visitor.dart:3099:10)
#7      SourceVisitor.run (package:dart_style/src/source_visitor.dart:120:5)
#8      DartFormatter.formatSource (package:dart_style/src/dart_formatter.dart:179:26)
#9      processFile (package:dart_style/src/io.dart:147:28)
#10     formatPaths (package:dart_style/src/io.dart:73:12)
#11     FormatCommand.run (package:dart_style/src/cli/format_command.dart:156:7)
#12     CommandRunner.runCommand (package:args/command_runner.dart:212:27)
#13     DartdevRunner.runCommand (package:dartdev/dartdev.dart:240:30)
#14     CommandRunner.run.<anonymous closure> (package:args/command_runner.dart:122:25)
#15     new Future.sync (dart:async/future.dart:305:31)
#16     CommandRunner.run (package:args/command_runner.dart:122:14)
#17     runDartdev (package:dartdev/dartdev.dart:59:29)
#18     main (file:///Users/srawlins/code/dart-sdk/sdk/pkg/dartdev/bin/dartdev.dart:11:9)
#19     _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:293:33)
#20     _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:184:12)

Formatted no files in 0.10 seconds.

The file in question is:

import 'package:yaml/yaml.dart';

  extension   type   _StatusInfo(YamlMap documentNode) {
}
@lrhn
Copy link
Member

lrhn commented Sep 25, 2023

That's tracked here: dart-lang/dart_style#1129

@lrhn lrhn closed this as completed Sep 25, 2023
@lrhn lrhn added the closed-duplicate Closed in favor of an existing report label Sep 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-duplicate Closed in favor of an existing report
Projects
None yet
Development

No branches or pull requests

2 participants