Skip to content
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

Extract Method extracts to non-static method in static context #4564

Closed
mosuem opened this issue May 26, 2023 · 2 comments
Closed

Extract Method extracts to non-static method in static context #4564

mosuem opened this issue May 26, 2023 · 2 comments
Labels
in editor Relates to code editing or language features in lsp/analysis server Something to be fixed in the Dart analysis server is bug relies on sdk changes Something that requires changes in the Dart/Flutter SDK to ship before it will become available
Milestone

Comments

@mosuem
Copy link

mosuem commented May 26, 2023

Describe the bug
Given a method

static String test = getNameBy((v) => v.toString());

when calling Extract Method on the inner lambda, it extracts to

static String test = getNameBy(newMethod);
String newMethod(v) => v.toString();

which then gives the implicit_this_reference_in_initializer error. It should instead extract to

static String test = getNameBy(newMethod);
static String newMethod(v) => v.toString();

Please complete the following information:
Dart SDK version: 3.1.0-39.0.dev (dev) (Mon Apr 24 18:53:55 2023 -0700) on "linux_x64"

Version: 1.78.0
Commit: 252e5463d60e63238250799aef7375787f68b4ee
Date: 2023-05-03T20:09:46.685Z
Electron: 22.4.8
Chromium: 108.0.5359.215
Node.js: 16.17.1
V8: 10.8.168.25-electron.0
OS: Linux x64 6.1.20-2rodete1-amd64
Sandboxed: No

Dart-Code v3.65.20230520 Pre-Release

@mosuem mosuem added the is bug label May 26, 2023
@DanTup DanTup added this to the v3.72.0 milestone Jul 27, 2023
@DanTup DanTup added in editor Relates to code editing or language features in lsp/analysis server Something to be fixed in the Dart analysis server labels Jul 27, 2023
@DanTup
Copy link
Member

DanTup commented Aug 2, 2023

Working on a fix at https://dart-review.googlesource.com/c/sdk/+/317780

@DanTup DanTup added the relies on sdk changes Something that requires changes in the Dart/Flutter SDK to ship before it will become available label Aug 2, 2023
copybara-service bot pushed a commit to dart-lang/sdk that referenced this issue Aug 2, 2023
Fixes Dart-Code/Dart-Code#4564

Change-Id: I9119941232cf17af7115fe5476ac1c4faa95cddb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/317780
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
@DanTup
Copy link
Member

DanTup commented Aug 3, 2023

Fixed by dart-lang/sdk@02c99b4, will ship in a future SDK release.

@DanTup DanTup closed this as completed Aug 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in editor Relates to code editing or language features in lsp/analysis server Something to be fixed in the Dart analysis server is bug relies on sdk changes Something that requires changes in the Dart/Flutter SDK to ship before it will become available
Projects
None yet
Development

No branches or pull requests

2 participants