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

Missing warning on partially-unused record destruction #60082

Open
ChaserVasya opened this issue Feb 8, 2025 · 3 comments
Open

Missing warning on partially-unused record destruction #60082

ChaserVasya opened this issue Feb 8, 2025 · 3 comments
Labels
analyzer-warning Issues with the analyzer's Warning codes area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. feature-wildcard-variables Implementation of the wildcard variables feature P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug

Comments

@ChaserVasya
Copy link

Snippet

void main() {
  final (a,b) = fn();
  print(a);
}

(int,int) fn(){
  return (1,2);
}

Expected

Warning The value of the local variable 'b' isn't used. .

Actual

Nothing.
Image

Context

Dart SDK version: 3.5.4 (stable) (Wed Oct 16 16:18:51 2024 +0000) on "macos_arm64"

@ChaserVasya ChaserVasya added the area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. label Feb 8, 2025
@bwilkerson
Copy link
Member

Just to note, the correct fix for this is to use a wildcard pattern in place of the unused variable pattern:

void main() {
  final (a,_) = fn();
  print(a);
}

(int,int) fn(){
  return (1,2);
}

@bwilkerson bwilkerson added analyzer-warning Issues with the analyzer's Warning codes P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug labels Feb 8, 2025
@ChaserVasya
Copy link
Author

ChaserVasya commented Feb 9, 2025

@bwilkerson Yes. Your solution should be a quick fix suggested by analyzer.

@bwilkerson
Copy link
Member

@pq @kallentu

@pq pq added the feature-wildcard-variables Implementation of the wildcard variables feature label Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer-warning Issues with the analyzer's Warning codes area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. feature-wildcard-variables Implementation of the wildcard variables feature P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

3 participants