Skip to content

Analysis server fails to notice that a file re-exporting main is runnable #45192

@stereotype441

Description

@stereotype441

Steps to reproduce:

  • Check out Dart SDK as of 8be5353
  • In IntelliJ, open the file pkg/front_end/test/unit_test_suites.dart
  • Right click within the file view

Expected result: the menu item Run 'unit_test_suites.dart' should be shown

Observed result: no Run menu item is shown

Note that all this file does is export unit_test_suites_impl.dart, which declares a main function. Therefore it should have a main function in its export namespace, so it should be runnable. Prior to null safety, this would have been a really obscure use case. However, with null safety, there's actually a really good reason to do this: it allows the entry point to be marked with // @dart = 2.9 (so that the program will be run in weak null safety mode), while leaving main opted in (so that it gets the static compilation benefits of null safety mode). This is necessary because due to out-of-order migration, some of the code in the program's transitive import graph has not yet been migrated to null safety. Now that null safety is out, I suspect this is going to be a much more common use case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3A lower priority bug or feature requestarea-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.contributions-welcomeContributions welcome to help resolve this (the resolution is expected to be clear from the issue)devexp-serverIssues related to some aspect of the analysis servertype-enhancementA request for a change that isn't a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions