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

Hint for when you export an identifier twice #33182

Closed
pq opened this issue May 20, 2018 · 7 comments
Closed

Hint for when you export an identifier twice #33182

pq opened this issue May 20, 2018 · 7 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.

Comments

@pq
Copy link
Member

pq commented May 20, 2018

From @Hixie on June 21, 2016 17:1

export 'package:flutter/rendering.dart' show
    Axis,
    BoxConstraints,
    CrossAxisAlignment,
    CustomClipper,
    CustomPainter,
    FixedColumnCountGridDelegate,
    Axis,
    ViewportDimensionsChangeCallback;

...did not cause an error (note the duplicate Axis).

Copied from original issue: dart-lang/linter#263

@pq
Copy link
Member Author

pq commented May 20, 2018

From @srawlins on May 19, 2018 4:6

I think this should even be a hint. I don't think there would be any false positives.

@pq
Copy link
Member Author

pq commented May 20, 2018

From @bwilkerson on May 19, 2018 4:19

I agree. It's another form of dead code so it should be a hint.

@pq
Copy link
Member Author

pq commented May 20, 2018

@bwilkerson : should we move this over to the SDK repo?

@pq
Copy link
Member Author

pq commented May 20, 2018

From @bwilkerson on May 20, 2018 14:7

Yes.

@pq pq added 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. and removed lint request labels May 20, 2018
@bwilkerson bwilkerson changed the title Lint for when you export an identifier twice Hint for when you export an identifier twice May 21, 2018
@srawlins
Copy link
Member

What about across import/export directives?

import 'dart:async';
import 'dart:async' show Future;

Future<void> main() async {
  print('hey');
}

I'd expect a warning on the second line, "Future is already imported on line 1."

@bwilkerson
Copy link
Member

Or we should flag the first line if Futture is the only identifier being used from async :-)

There's always a trade-off. If users are seeing this error frequently enough that the added checks would be helpful, then we should do it. If not, then we aren't necessarily doing are users a favor by (a) taking the time to implement this rather than some more useful functionality and (b) spending their processor's cycles to confirm that there are no problems. I have no data for how helpful such a check would be.

dart-bot pushed a commit that referenced this issue May 30, 2018
Bug: #33182
Change-Id: Ibb82c44357bc59044340c6d8b1904c7815d19215
Reviewed-on: https://dart-review.googlesource.com/57161
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
@srawlins
Copy link
Member

Landed!

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.
Projects
None yet
Development

No branches or pull requests

3 participants