sdk
sdk copied to clipboard
Analyzer crashes when a file contains both a `part` and `part of` in the same file.
- Dart version and tooling diagnostic info (
dart info)
If providing this information as part of reporting a bug, please review the information
below to ensure it only contains things you're comfortable posting publicly.
#### General info
- Dart 3.3.0-279.3.beta (beta) (Wed Jan 31 15:24:56 2024 +0000) on "windows_x64"
- on windows / "Windows 10 Pro" 10.0 (Build 22631)
- locale is en-US
#### Project info
- sdk constraint: '>=3.1.5 <4.0.0'
- dependencies: animations, blurhash_dart, convert, crypto, cupertino_icons, dio, equatable, flutter, flutter_localizations, flutter_riverpod, flutter_svg, go_router, image, intl, json_annotation, riverpod_annotation, shared_preferences, system_theme
- dev_dependencies: build_runner, custom_lint, flutter_gen_runner, flutter_lints, flutter_native_splash, flutter_test, json_serializable, riverpod_generator, riverpod_lint
#### Process info
| Memory | CPU | Elapsed time | Command line |
| -----: | --: | -----------: | ------------ |
| 91 MB | -- | | dart.exe |
| 95 MB | -- | | dart.exe |
| 96 MB | -- | | dart.exe |
what causes issue is making file have a part and part of in the same file
some logs from LSP
---\lib\theme\theme_mode\state.dart
[Error - 5:16:07 PM] Request textDocument/inlayHint failed.
Message: File is not being analyzed
Code: -32007
---\lib\theme\theme_mode\state.dart
[Error - 5:16:22 PM] Request textDocument/documentSymbol failed.
Message: Analysis failed for file
Code: -32013
---\lib\theme\theme_mode\state.dart
[Error - 5:16:22 PM] The Dart Analysis Server server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.
fixing it is by removing the unlogical syntax, the issue disappers but after ide restart
@scheglov
I cannot reproduce it. The test below reports some errors, but no crash.
solo_test_X() async {
newFile('$testPackageLibPath/a.dart', r'''
part 'test.dart';
''');
await assertErrorsInCode(r'''
part 'a.dart';
part of 'a.dart';
''', [
error(ParserErrorCode.NON_PART_OF_DIRECTIVE_IN_PART, 15, 4),
]);
}
Hmmm, part 'a.dart'; part of 'a.dart'; is not derivable from <libraryDeclaration> and not derivable from <partDeclaration>, which would presumably make it a syntax error?
Sorry, yes, you are right, there is a syntactic error. I was mostly saying that there is no crash, and kind of the diagnostic did not seem important then :-) I updated my previous message.