Skip to content

Nonsensical error message on variable rename #3159

Closed

Description

@larssn

Describe the bug
Renaming date to now fails with:
Usage of constructor "DateTime.now" declared in "date_time.dart" will be shadowed by renamed local variable.

test() {
  final date = DateTime.now();
}

To Reproduce
Steps to reproduce the behavior:

  1. Try the above

Expected behavior
now is a valid name, and shouldn't fail. It also doesn't shadow anything, as it seems to think.

Versions (please complete the following information):

  • VS Code version: 1.53.2
  • Dart extension version: 3.19.2
  • Dart/Flutter SDK version: >=2.10.0 <3.0.0

Activity

  1. DanTup commented on Feb 24, 2021

    @DanTup
    Member

    Thanks for the report! I can reproduce this - the message is coming from the language server so I've filed dart-lang/sdk#45105. Thanks!

  2. added
    in editorRelates to code editing or language features
    in lsp/analysis serverSomething to be fixed in the Dart analysis server
    and removed on Feb 24, 2021
  3. added this to the v3.21.0 milestone on Feb 24, 2021
  4. DanTup commented on Feb 25, 2021

    @DanTup
    Member

    This has been fixed by dart-lang/sdk@526e191 and will be included in a future Dart/Flutter SDK update. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    in editorRelates to code editing or language featuresin lsp/analysis serverSomething to be fixed in the Dart analysis serveris bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions