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

Comments

@pq
Copy link
Member

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

This comment has been minimized.

Copy link
Member Author

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

This comment has been minimized.

Copy link
Member Author

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

This comment has been minimized.

Copy link
Member Author

commented May 20, 2018

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

@pq

This comment has been minimized.

Copy link
Member Author

commented May 20, 2018

From @bwilkerson on May 20, 2018 14:7

Yes.

@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

This comment has been minimized.

Copy link
Member

commented May 29, 2018

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

This comment has been minimized.

Copy link
Member

commented May 29, 2018

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
Add HintCode for duplicate shown/hidden names
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

This comment has been minimized.

Copy link
Member

commented May 30, 2018

Landed!

@srawlins srawlins closed this May 30, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.