@@ -243,6 +243,7 @@ static void addToVirtualMaps(FnSymbol* pfn,
243
243
FnSymbol* cfn) {
244
244
245
245
FnSymbol* fn = getInstantiatedFunction (pfn, ct, cfn);
246
+
246
247
resolveOverride (pfn, fn);
247
248
}
248
249
@@ -285,27 +286,7 @@ static void collectMethods(FnSymbol* pfn,
285
286
}
286
287
}
287
288
if (possibleSignatureMatch (pfn, cfn) == true ) {
288
- if (cfn->retTag == RET_PARAM ||
289
- cfn->retTag == RET_TYPE) {
290
- USR_FATAL_CONT (cfn,
291
- " param default arguments in overridden methods "
292
- " are not yet supported." );
293
- } else {
294
- methods.push_back (cfn);
295
- }
296
-
297
- // check to see if we are using defaulted actual fns
298
- // for any of the formals in pfn. If so, make sure the
299
- // corresponding ones exist for the child.
300
- int nUserFormals = getNumUserFormals (pfn);
301
- for (int i = 1 ; i <= nUserFormals; i++) {
302
- ArgSymbol* pformal = getUserFormal (pfn, i);
303
- ArgSymbol* cformal = getUserFormal (cfn, i);
304
- FnSymbol* pDefFn = findExistingDefaultedActualFn (pfn, pformal);
305
- if (pDefFn) {
306
- getOrCreateDefaultedActualFn (cfn, cformal);
307
- }
308
- }
289
+ methods.push_back (cfn);
309
290
}
310
291
}
311
292
}
@@ -469,6 +450,31 @@ static void resolveOverride(FnSymbol* pfn, FnSymbol* cfn) {
469
450
470
451
resolveFunction (cfn);
471
452
453
+ // check to see if we are using defaulted actual fns
454
+ // for any of the formals in pfn. If so, make sure the
455
+ // corresponding ones exist for the child.
456
+ int nUserFormals = getNumUserFormals (pfn);
457
+ for (int i = 1 ; i <= nUserFormals; i++) {
458
+ ArgSymbol* pFormal = getUserFormal (pfn, i);
459
+ ArgSymbol* cFormal = getUserFormal (cfn, i);
460
+ FnSymbol* pDefFn = findExistingDefaultedActualFn (pfn, pFormal);
461
+ if (pDefFn) {
462
+ FnSymbol* cDefFn = getOrCreateDefaultedActualFn (cfn, cFormal);
463
+ if (cDefFn) {
464
+ if (pFormal->hasFlag (FLAG_INSTANTIATED_PARAM) &&
465
+ cFormal->hasFlag (FLAG_INSTANTIATED_PARAM)) {
466
+ USR_FATAL_CONT (cfn, " param default arguments in overridden methods"
467
+ " are not yet supported." );
468
+ }
469
+ if (pFormal->hasFlag (FLAG_TYPE_VARIABLE) &&
470
+ cFormal->hasFlag (FLAG_TYPE_VARIABLE)) {
471
+ USR_FATAL_CONT (cfn, " type default arguments in overridden methods"
472
+ " are not yet supported." );
473
+ }
474
+ }
475
+ }
476
+ }
477
+
472
478
if (checkOverrides (cfn) &&
473
479
!ignoreOverrides (cfn) &&
474
480
!cfn->hasFlag (FLAG_OVERRIDE)) {
0 commit comments