@@ -212,43 +212,28 @@ Call getASignatureMismatchWitness(Function base, Function sub) {
212212 not callMatchesSignature ( sub , result )
213213}
214214
215- /** Choose a 'witnessing' call that matches the signature of `base` but not of overridden `sub`, and is in the file `file`. */
216- Call chooseASignatureMismatchWitnessInFile ( Function base , Function sub , File file ) {
217- result =
218- min ( Call c |
219- c = getASignatureMismatchWitness ( base , sub ) and
220- c .getLocation ( ) .getFile ( ) = file
221- |
222- c order by c .getLocation ( ) .getStartLine ( ) , c .getLocation ( ) .getStartColumn ( )
223- )
215+ pragma [ inline]
216+ string preferredFile ( File callFile , Function base , Function sub ) {
217+ if callFile = getFunctionFile ( base )
218+ then result = " A"
219+ else
220+ if callFile = getFunctionFile ( sub )
221+ then result = " B"
222+ else result = callFile .getAbsolutePath ( )
224223}
225224
226225/** Choose a 'witnessing' call that matches the signature of `base` but not of overridden `sub`. */
227226Call chooseASignatureMismatchWitness ( Function base , Function sub ) {
228227 exists ( getASignatureMismatchWitness ( base , sub ) ) and
229- (
230- result = chooseASignatureMismatchWitnessInFile ( base , sub , getFunctionFile ( base ) )
231- or
232- not exists ( Call c |
233- c = getASignatureMismatchWitness ( base , sub ) and
234- c .getLocation ( ) .getFile ( ) = base .getLocation ( ) .getFile ( )
235- ) and
236- result = chooseASignatureMismatchWitnessInFile ( base , sub , getFunctionFile ( sub ) )
237- or
238- not exists ( Call c |
239- c = getASignatureMismatchWitness ( base , sub ) and
240- c .getLocation ( ) .getFile ( ) = getFunctionFile ( [ base , sub ] )
241- ) and
242- result =
243- min ( Call c |
244- c = getASignatureMismatchWitness ( base , sub )
245- |
246- c
247- order by
248- c .getLocation ( ) .getFile ( ) .getAbsolutePath ( ) , c .getLocation ( ) .getStartLine ( ) ,
249- c .getLocation ( ) .getStartColumn ( )
250- )
251- )
228+ result =
229+ min ( Call c |
230+ c = getASignatureMismatchWitness ( base , sub )
231+ |
232+ c
233+ order by
234+ preferredFile ( c .getLocation ( ) .getFile ( ) , base , sub ) , c .getLocation ( ) .getStartLine ( ) ,
235+ c .getLocation ( ) .getStartColumn ( )
236+ )
252237}
253238
254239module CallOption = LocatableOption< Location , Call > ;
0 commit comments