mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Sema: Don't reuse PreparedOverload from normal type checking in salvage()
We want to re-prepare our overloads, since now they will contain fixes.
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include "swift/Basic/Compiler.h"
|
||||
#include "swift/Sema/Constraint.h"
|
||||
#include "swift/Sema/ConstraintSystem.h"
|
||||
#include "swift/Sema/PreparedOverload.h"
|
||||
#include "llvm/Support/Compiler.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include <algorithm>
|
||||
@@ -1142,3 +1143,18 @@ void *Constraint::operator new(size_t bytes, ConstraintSystem& cs,
|
||||
size_t alignment) {
|
||||
return ::operator new (bytes, cs, alignment);
|
||||
}
|
||||
|
||||
// FIXME: Perhaps we should store the Constraint -> PreparedOverload mapping
|
||||
// in a SolverStep or something? Mutating Constraint feels wrong.
|
||||
|
||||
void Constraint::setPreparedOverload(PreparedOverload *preparedOverload) {
|
||||
ASSERT(Kind == ConstraintKind::BindOverload);
|
||||
|
||||
// We can only set a prepared overload at most once in normal
|
||||
// type checking, and then once in salvage.
|
||||
ASSERT(!Overload.Prepared ||
|
||||
(!Overload.Prepared->wasForDiagnostics() &&
|
||||
preparedOverload->wasForDiagnostics()));
|
||||
|
||||
Overload.Prepared = preparedOverload;
|
||||
}
|
||||
Reference in New Issue
Block a user