| 399 | } |
| 400 | |
| 401 | void BfAmbiguityContext::Finish() |
| 402 | { |
| 403 | for (auto& entryPair : mEntries) |
| 404 | { |
| 405 | int id = entryPair.mKey; |
| 406 | auto entry = &entryPair.mValue; |
| 407 | |
| 408 | if (id >= 0) |
| 409 | { |
| 410 | auto declMethodInstance = mTypeInstance->mVirtualMethodTable[id].mDeclaringMethod; |
| 411 | auto error = mModule->Fail(StrFormat("Method '%s' has ambiguous overrides", mModule->MethodToString(declMethodInstance).c_str()), declMethodInstance->mMethodDef->GetRefNode()); |
| 412 | if (error != NULL) |
| 413 | { |
| 414 | for (auto candidate : entry->mCandidates) |
| 415 | { |
| 416 | mModule->mCompiler->mPassInstance->MoreInfo(StrFormat("'%s' is a candidate", |
| 417 | mModule->MethodToString(candidate, (BfMethodNameFlags)(BfMethodNameFlag_ResolveGenericParamNames | BfMethodNameFlag_IncludeReturnType)).c_str()), candidate->mMethodDef->GetRefNode()); |
| 418 | } |
| 419 | } |
| 420 | } |
| 421 | else |
| 422 | { |
| 423 | auto iMethodInst = entry->mInterfaceEntry->mInterfaceType->mMethodInstanceGroups[entry->mMethodIdx].mDefault; |
| 424 | auto error = mModule->Fail(StrFormat("Interface method '%s' has ambiguous implementations", mModule->MethodToString(iMethodInst).c_str()), entry->mInterfaceEntry->mDeclaringType->GetRefNode()); |
| 425 | if (error != NULL) |
| 426 | { |
| 427 | for (auto candidate : entry->mCandidates) |
| 428 | { |
| 429 | mModule->mCompiler->mPassInstance->MoreInfo(StrFormat("'%s' is a candidate", |
| 430 | mModule->MethodToString(candidate, (BfMethodNameFlags)(BfMethodNameFlag_ResolveGenericParamNames | BfMethodNameFlag_IncludeReturnType)).c_str()), candidate->mMethodDef->GetRefNode()); |
| 431 | } |
| 432 | } |
| 433 | } |
| 434 | } |
| 435 | mEntries.Clear(); |
| 436 | } |
| 437 | |
| 438 | ////////////////////////////////////////////////////////////////////////// |
| 439 |
no test coverage detected