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

Make it an error if a class includes in its super-interfaces the same generic interface twice with different type parameters #32148

Closed
stereotype441 opened this issue Feb 14, 2018 · 1 comment
Assignees
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion.

Comments

@stereotype441
Copy link
Member

This is not allowed in Dart 2.0, so we need to prohibit it in the analyzer.

@stereotype441 stereotype441 added the area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. label Feb 14, 2018
@stereotype441 stereotype441 self-assigned this Feb 14, 2018
stereotype441 added a commit to stereotype441/file.dart that referenced this issue Mar 1, 2018
Due to an upcoming change in Dart 2.0
(dart-lang/sdk#32148), it will no longer be
allowed for a class to implement the same generic interface in
different ways.  (E.g. a class cannot implement/extend/mixin both
A<int> and A<String>).

This causes problems with _LocalDirectory.  It extends
_LocalFileSystemEntity<_LocalDirectory, Directory>, which extends
ForwardingFileSystemEntity<_LocalDirectory, Directory>, but it mixes
in ForwardingDirectory, which extends
ForwardingFileSystemEntity<Directory, io.Directory>.

The solution is to make ForwardingDirectory a generic mixin, with
ForwardingDirectory<T> extending ForwardingFileSystemEntity<T,
io.Directory>.  Type inference automatically fills in the type
argument T=_LocalDirectory at the site of the declaration of
_LocalDirectory.
tvolkert pushed a commit to google/file.dart that referenced this issue Mar 1, 2018
Due to an upcoming change in Dart 2.0
(dart-lang/sdk#32148), it will no longer be
allowed for a class to implement the same generic interface in
different ways.  (E.g. a class cannot implement/extend/mixin both
A<int> and A<String>).

This causes problems with _LocalDirectory.  It extends
_LocalFileSystemEntity<_LocalDirectory, Directory>, which extends
ForwardingFileSystemEntity<_LocalDirectory, Directory>, but it mixes
in ForwardingDirectory, which extends
ForwardingFileSystemEntity<Directory, io.Directory>.

The solution is to make ForwardingDirectory a generic mixin, with
ForwardingDirectory<T> extending ForwardingFileSystemEntity<T,
io.Directory>.  Type inference automatically fills in the type
argument T=_LocalDirectory at the site of the declaration of
_LocalDirectory.
@stereotype441
Copy link
Member Author

Fixed in 2993476

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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

1 participant