Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions include/swift/IDE/TypeCheckCompletionCallback.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,19 +86,16 @@ struct WithSolutionSpecificVarTypesRAII {

WithSolutionSpecificVarTypesRAII(
llvm::SmallDenseMap<const VarDecl *, Type> SolutionSpecificVarTypes) {
for (auto SolutionVarType : SolutionSpecificVarTypes) {
if (SolutionVarType.first->hasInterfaceType()) {
RestoreVarTypes[SolutionVarType.first] =
SolutionVarType.first->getInterfaceType();
for (auto &[var, ty] : SolutionSpecificVarTypes) {
if (var->hasInterfaceType()) {
RestoreVarTypes[var] = var->getInterfaceType();
} else {
RestoreVarTypes[SolutionVarType.first] = Type();
RestoreVarTypes[var] = Type();
}
if (!SolutionVarType.second->hasArchetype()) {
setInterfaceType(const_cast<VarDecl *>(SolutionVarType.first),
SolutionVarType.second);
if (!ty->hasArchetype() && !ty->hasUnresolvedType()) {
setInterfaceType(const_cast<VarDecl *>(var), ty);
} else {
setInterfaceType(const_cast<VarDecl *>(SolutionVarType.first),
ErrorType::get(SolutionVarType.second));
setInterfaceType(const_cast<VarDecl *>(var), ErrorType::get(ty));
}
}
}
Expand Down
7 changes: 7 additions & 0 deletions validation-test/IDE/crashers_fixed/bfc920b5867dcc4c.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// {"kind":"complete","original":"03137cdb","signature":"swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::constraints::SyntacticElementTarget)","signatureAssert":"Assertion failed: (isValidType(type) && \"type binding has invalid type\"), function applySolution"}
// RUN: %target-swift-ide-test -code-completion -batch-code-completion -skip-filecheck -code-completion-diagnostics -source-filename %s
@propertyWrapper struct a<b {
wrappedValue: b
}
{
@a var c #^^#
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// {"kind":"complete","original":"ad5b343d","signature":"swift::InterfaceTypeRequest::cacheResult(swift::Type) const","signatureAssert":"Assertion failed: (!type->is<InOutType>() && \"Interface type must be materializable\"), function cacheResult"}
// RUN: not --crash %target-swift-ide-test -code-completion -batch-code-completion -skip-filecheck -code-completion-diagnostics -source-filename %s
// RUN: %target-swift-ide-test -code-completion -batch-code-completion -skip-filecheck -code-completion-diagnostics -source-filename %s
[
#^^#
].reduce?(
Expand Down