Skip to content

Commit ed1a372

Browse files
authored
Merge pull request swiftlang#84368 from hamishknight/unresolved
2 parents 292dd23 + a976af0 commit ed1a372

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

include/swift/IDE/TypeCheckCompletionCallback.h

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -86,19 +86,16 @@ struct WithSolutionSpecificVarTypesRAII {
8686

8787
WithSolutionSpecificVarTypesRAII(
8888
llvm::SmallDenseMap<const VarDecl *, Type> SolutionSpecificVarTypes) {
89-
for (auto SolutionVarType : SolutionSpecificVarTypes) {
90-
if (SolutionVarType.first->hasInterfaceType()) {
91-
RestoreVarTypes[SolutionVarType.first] =
92-
SolutionVarType.first->getInterfaceType();
89+
for (auto &[var, ty] : SolutionSpecificVarTypes) {
90+
if (var->hasInterfaceType()) {
91+
RestoreVarTypes[var] = var->getInterfaceType();
9392
} else {
94-
RestoreVarTypes[SolutionVarType.first] = Type();
93+
RestoreVarTypes[var] = Type();
9594
}
96-
if (!SolutionVarType.second->hasArchetype()) {
97-
setInterfaceType(const_cast<VarDecl *>(SolutionVarType.first),
98-
SolutionVarType.second);
95+
if (!ty->hasArchetype() && !ty->hasUnresolvedType()) {
96+
setInterfaceType(const_cast<VarDecl *>(var), ty);
9997
} else {
100-
setInterfaceType(const_cast<VarDecl *>(SolutionVarType.first),
101-
ErrorType::get(SolutionVarType.second));
98+
setInterfaceType(const_cast<VarDecl *>(var), ErrorType::get(ty));
10299
}
103100
}
104101
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// {"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"}
2+
// RUN: %target-swift-ide-test -code-completion -batch-code-completion -skip-filecheck -code-completion-diagnostics -source-filename %s
3+
@propertyWrapper struct a<b {
4+
wrappedValue: b
5+
}
6+
{
7+
@a var c #^^#

validation-test/IDE/crashers/c9b7522368139eb7.swift renamed to validation-test/IDE/crashers_fixed/c9b7522368139eb7.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// {"kind":"complete","original":"ad5b343d","signature":"swift::InterfaceTypeRequest::cacheResult(swift::Type) const","signatureAssert":"Assertion failed: (!type->is<InOutType>() && \"Interface type must be materializable\"), function cacheResult"}
2-
// RUN: not --crash %target-swift-ide-test -code-completion -batch-code-completion -skip-filecheck -code-completion-diagnostics -source-filename %s
2+
// RUN: %target-swift-ide-test -code-completion -batch-code-completion -skip-filecheck -code-completion-diagnostics -source-filename %s
33
[
44
#^^#
55
].reduce?(

0 commit comments

Comments
 (0)