Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(240)

Unified Diff: pkg/analyzer/lib/src/dart/resolver/inheritance_manager.dart

Issue 3006643002: Inheritance manager fix for fuzzy arrows (Closed)
Patch Set: Rebase Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/dart/resolver/inheritance_manager.dart
diff --git a/pkg/analyzer/lib/src/dart/resolver/inheritance_manager.dart b/pkg/analyzer/lib/src/dart/resolver/inheritance_manager.dart
index 1773241bea4829f122e5c7672ce161a01678713c..2d32994deeca0a3b82ec951eaa456e9414f70756 100644
--- a/pkg/analyzer/lib/src/dart/resolver/inheritance_manager.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/inheritance_manager.dart
@@ -817,6 +817,11 @@ class InheritanceManager {
// Tests: test_getMapOfMembersInheritedFromInterfaces_
// union_multipleSubtypes_*
//
+ // TODO(leafp): this produces (dynamic) -> dynamic even if
+ // the types are equal which gives bad error messages. If
+ // types are equal, we should consider using them. Even
+ // better, consider using the GLB of the parameter types
+ // and the LUB of the return types
List<ExecutableElement> elementArrayToMerge =
new List<ExecutableElement>(
subtypesOfAllOtherTypesIndexes.length);
@@ -920,7 +925,7 @@ class InheritanceManager {
* <i>s</i> of type <b>dynamic</b> and return type <b>dynamic</b>.
*
*/
- static ExecutableElement _computeMergedExecutableElement(
+ ExecutableElement _computeMergedExecutableElement(
List<ExecutableElement> elementArrayToMerge) {
int h = _getNumOfPositionalParameters(elementArrayToMerge[0]);
int r = _getNumOfRequiredParameters(elementArrayToMerge[0]);
@@ -956,13 +961,16 @@ class InheritanceManager {
* @param namedParameters the list of [String]s that are the named parameters
* @return the created synthetic element
*/
- static ExecutableElement _createSyntheticExecutableElement(
+ ExecutableElement _createSyntheticExecutableElement(
List<ExecutableElement> elementArrayToMerge,
String name,
int numOfRequiredParameters,
int numOfPositionalParameters,
List<String> namedParameters) {
DynamicTypeImpl dynamicType = DynamicTypeImpl.instance;
+ DartType bottomType = _library.context.analysisOptions.strongMode
+ ? BottomTypeImpl.instance
+ : dynamicType;
SimpleIdentifier nameIdentifier = astFactory
.simpleIdentifier(new StringToken(TokenType.IDENTIFIER, name, 0));
ExecutableElementImpl executable;
@@ -991,20 +999,20 @@ class InheritanceManager {
int i = 0;
for (int j = 0; j < numOfRequiredParameters; j++, i++) {
ParameterElementImpl parameter = new ParameterElementImpl("", 0);
- parameter.type = dynamicType;
+ parameter.type = bottomType;
parameter.parameterKind = ParameterKind.REQUIRED;
parameters[i] = parameter;
}
for (int k = 0; k < numOfPositionalParameters; k++, i++) {
ParameterElementImpl parameter = new ParameterElementImpl("", 0);
- parameter.type = dynamicType;
+ parameter.type = bottomType;
parameter.parameterKind = ParameterKind.POSITIONAL;
parameters[i] = parameter;
}
for (int m = 0; m < namedParameters.length; m++, i++) {
ParameterElementImpl parameter =
new ParameterElementImpl(namedParameters[m], 0);
- parameter.type = dynamicType;
+ parameter.type = bottomType;
parameter.parameterKind = ParameterKind.NAMED;
parameters[i] = parameter;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698