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

Error: conflicting types for "Element" #1007

Closed
DartBot opened this issue Dec 30, 2011 · 9 comments
Closed

Error: conflicting types for "Element" #1007

DartBot opened this issue Dec 30, 2011 · 9 comments
Labels
closed-as-intended Closed as the reported issue is expected behavior type-enhancement A request for a change that isn't a bug

Comments

@DartBot
Copy link

DartBot commented Dec 30, 2011

This issue was originally filed by [email protected]


What steps will reproduce the problem?

  1. adding this line to dart/utils/dartdoc/interact.dart:
       var query = new Element.tag('input');

breaks the compilation of interact.dart

../../client/html/release/html.dart:11520:1: error: conflicting types for "Element"
interface Element extends Node /*, common.NodeSelector, common.ElementTraversal */
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../../frog/element.dart:9:1: error: conflicting types for "Element"
class Element implements Hashable {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

What version of the product are you using? On what operating system?
bleeding_edge, revision 2883

Please provide any additional information below.
Problem started 29.12.2011 around noon.

@dgrove
Copy link
Contributor

dgrove commented Jan 2, 2012

nice naming conflict :(

Assigning to frog, but this is a nasty example of the name collision issues that we've been seeing.


cc @munificent.
cc @jacob314.
cc @jmesserly.
cc @gbracha.
Added Area-Frog, Triaged labels.

@jmesserly
Copy link

IMO, the best fix would be to improve language prefixes so disambiguation is only needed for actual conflicts.

As a stopgap we could rename compiler types so they don't conflict with the DOM, but that seems strange, since the compiler is not usually running in the browser. And the DOM steals some good names like "Node" and "Element"


Removed Type-Defect label.
Added Type-Enhancement label.

@jmesserly
Copy link

Moved to enhancement because there is a workaround: use prefixes for either frog or the html lib.

@DartBot
Copy link
Author

DartBot commented Jan 6, 2012

This comment was originally written by [email protected]


Workaround looks ok.

One problem: you will need to rewrite any files sourced into the current library to reflect the new prefix.

@anders-sandholm
Copy link
Contributor

Removed Area-Frog label.
Added Area-Dart2JS, FromAreaFrog labels.

@kasperl
Copy link

kasperl commented Jun 12, 2012

Is this a DOM issue?


Removed Area-Dart2JS, FromAreaFrog labels.
Added Area-DOM label.

@jacob314
Copy link
Member

This is not a DOM issue. The problem was just that the frog library and the DOM library both have classes named element. The DOM class named Element should stay named element. If you actually wanted to import both dart:html and a compiler containing a class named Element, the right solution is to prefix one of the two libraries ideally with a mechanism that allows only prefixing the actual conflicts.

@gbracha
Copy link
Contributor

gbracha commented Jun 12, 2012

So, given import scoping changes and show:, hide: in the pipeline, I expect this will be simple to resolve (once those features are implemented):

#import ('dart:html');
#import('frogLib.dart', prefix: 'frog');

Or (f all you wantto worry about prefixing is frogLib.Element)

#import('frogLib.dart', hide: ['Element']);
#import('frogLib.dart', prefix: 'frog', show:["Element']);

@jmesserly
Copy link

Agreed. Closed as by design of language prefixing mechanism.


Added AsDesigned label.

@DartBot DartBot added Type-Enhancement closed-as-intended Closed as the reported issue is expected behavior labels Jun 12, 2012
@kevmoo kevmoo added type-enhancement A request for a change that isn't a bug and removed type-enhancement labels Mar 1, 2016
copybara-service bot pushed a commit that referenced this issue Aug 28, 2023
Revisions updated by `dart tools/rev_sdk_deps.dart`.

http (https://github.com/dart-lang/http/compare/631d4ec..cad7d60):
  cad7d60  2023-08-26  Alex James  Add response status code test (#1009)
  5ac7cfe  2023-08-24  Alex James  JavaClient stream response body using byte arrays (#1007)
  0e6e58a  2023-08-23  Brian Quinlan  Don't check the formatting of `ffigen`ed code (#1010)

markdown (https://github.com/dart-lang/markdown/compare/faabb1a..56e75df):
  56e75df  2023-08-26  Parker Lougheed  Standardize CommonMark spec links to https and v0.30 (#553)

mockito (https://github.com/dart-lang/mockito/compare/70aabfc..f5abf11):
  f5abf11  2023-08-28  Nate Bosch  Add a best practice sentence about data models

tools (https://github.com/dart-lang/tools/compare/e5ce42a..b72fae8):
  b72fae8  2023-08-24  Danny Tuppeny  Export Survey in package:unified_analytics (#151)

Change-Id: Id09f2300d3132a101dfaf84d9dc475ba92590aeb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/322980
Reviewed-by: Konstantin Shcheglov <[email protected]>
Commit-Queue: Devon Carew <[email protected]>
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-as-intended Closed as the reported issue is expected behavior type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

8 participants