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

DartType.isEquivalentTo should be cleaned up #35331

Open
stereotype441 opened this Issue Dec 5, 2018 · 0 comments

Comments

Projects
None yet
1 participant
@stereotype441
Member

stereotype441 commented Dec 5, 2018

The existence of the DartType.isEquivalentTo method is confusing. Two DartType objects should be considered equal (and have the same hashCode) if and only if the represent the same type as defined by the spec.

So for instance, given the typedef:

typedef void F<T>(); // T is not used!

F<int>, F<bool>, and () -> void all represent the same type in the eyes of the spec. The analyzer's isEquivalentTo method reports that they are equivalent, but operator== and hashCode treat them as different.

We should fix this so that operator== and hashCode treat the types as equivalent.

I suspect this will require substantial rework of the FunctionType class.

For more details see comments in https://dart-review.googlesource.com/c/sdk/+/86222/2/pkg/analyzer/lib/dart/element/type.dart.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment