Skip to content

Extension reexport doesn't handle name conflicts correctly #2047

@jcollins-g

Description

@jcollins-g

-- from @stereotype441

I'm worried this might not do the right thing. Consider files foo.dart and bar.dart, each of which defines a distinct extension called E. Then if we have a library like this:

export 'foo.dart' show E;
export 'bar.dart' hide E;

Then I think both Es will get included in extensionElements, because both of them have a name that matches a name that exists in _exportedNamespace.

The best correct approach I can currently think of is:

  • Expose an analyzer API to allow clients to figure out which elements are actually exported by an ExportElement (e.g. we could expose dartdoc to filter a set of elements via namespace combinators (we could move NamespaceBuilder._applyCombinators to ExportElement and re-name it appropriately)
  • Change this code to iterate through the export elements rather than the exported libraries, so that it can use the newly exposed API to figure out exactly which extensions are shown.

It's ok with me if you want to file an issue and address this in a later PR.

Originally posted by @stereotype441 in #2045

Metadata

Metadata

Assignees

Labels

P1A high priority bug; for example, a single project is unusable or has many test failurestype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions