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:
@@ -883,11 +883,7 @@ public:
|
||||
return Overload.Prepared;
|
||||
}
|
||||
|
||||
void setPreparedOverload(PreparedOverload *preparedOverload) {
|
||||
ASSERT(Kind == ConstraintKind::BindOverload);
|
||||
ASSERT(!Overload.Prepared);
|
||||
Overload.Prepared = preparedOverload;
|
||||
}
|
||||
void setPreparedOverload(PreparedOverload *preparedOverload);
|
||||
|
||||
FunctionType *getAppliedFunctionType() const {
|
||||
assert(Kind == ConstraintKind::ApplicableFunction);
|
||||
|
||||
@@ -4876,7 +4876,8 @@ public:
|
||||
/// Build and allocate a prepared overload in the solver arena.
|
||||
PreparedOverload *prepareOverload(OverloadChoice choice,
|
||||
DeclContext *useDC,
|
||||
ConstraintLocator *locator);
|
||||
ConstraintLocator *locator,
|
||||
bool forDiagnostics);
|
||||
|
||||
/// Populate the prepared overload with all type variables and constraints
|
||||
/// that are to be introduced into the constraint system when this choice
|
||||
|
||||
@@ -160,7 +160,11 @@ public:
|
||||
private:
|
||||
Type OpenedType;
|
||||
Type ThrownErrorType;
|
||||
size_t Count;
|
||||
unsigned Count : 31;
|
||||
|
||||
/// A prepared overload for diagnostics is different than one without,
|
||||
/// because of fixes and such.
|
||||
unsigned ForDiagnostics : 1;
|
||||
|
||||
size_t numTrailingObjects(OverloadToken<Change>) const {
|
||||
return Count;
|
||||
@@ -168,9 +172,9 @@ private:
|
||||
|
||||
public:
|
||||
PreparedOverload(Type openedType, Type thrownErrorType,
|
||||
ArrayRef<Change> changes)
|
||||
ArrayRef<Change> changes, bool forDiagnostics)
|
||||
: OpenedType(openedType), ThrownErrorType(thrownErrorType),
|
||||
Count(changes.size()) {
|
||||
Count(changes.size()), ForDiagnostics(forDiagnostics) {
|
||||
std::uninitialized_copy(changes.begin(), changes.end(),
|
||||
getTrailingObjects());
|
||||
}
|
||||
@@ -183,6 +187,10 @@ public:
|
||||
return ThrownErrorType;
|
||||
}
|
||||
|
||||
bool wasForDiagnostics() const {
|
||||
return ForDiagnostics;
|
||||
}
|
||||
|
||||
ArrayRef<Change> getChanges() const { return getTrailingObjects(Count); }
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user