File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -1064,10 +1064,19 @@ class ErrorType extends Type {
10641064 ErrorType ( ) { this .implements ( Builtin:: error ( ) .getType ( ) .getUnderlyingType ( ) ) }
10651065}
10661066
1067+ /**
1068+ * Gets the number of types with method `name`.
1069+ */
1070+ bindingset [ name]
1071+ int numberOfTypesWithMethodName ( string name ) { result = count ( Type t | t .hasMethod ( name , _) ) }
1072+
10671073/**
10681074 * Gets the name of a method in the method set of `i`.
10691075 *
10701076 * This is used to restrict the set of interfaces to consider in the definition of `implements`,
1071- * so it does not matter which method name is chosen (we use the lexicographically least).
1077+ * so it does not matter which method name is chosen (we use the most unusual name the interface
1078+ * require; this is the most discriminating and so shrinks the search space the most).
10721079 */
1073- private string getExampleMethodName ( InterfaceType i ) { result = min ( string m | i .hasMethod ( m , _) ) }
1080+ private string getExampleMethodName ( InterfaceType i ) {
1081+ result = min ( string m | i .hasMethod ( m , _) | m order by numberOfTypesWithMethodName ( m ) )
1082+ }
You can’t perform that action at this time.
0 commit comments