Skip to content

Nonsensical error message on variable rename #3159

@larssn

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

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