mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[CS] Avoid escaping solver-allocated types in computeSubstitutions
Make sure we call `simplifyType` for the opened type bindings to ensure holes get converted to UnresolvedType. rdar://154553285
This commit is contained in:
@@ -116,7 +116,7 @@ Solution::computeSubstitutions(NullablePtr<ValueDecl> decl,
|
|||||||
} else if (!type->is<PackType>())
|
} else if (!type->is<PackType>())
|
||||||
type = PackType::getSingletonPackExpansion(type);
|
type = PackType::getSingletonPackExpansion(type);
|
||||||
}
|
}
|
||||||
replacementTypes.push_back(type);
|
replacementTypes.push_back(simplifyType(type));
|
||||||
}
|
}
|
||||||
|
|
||||||
auto lookupConformanceFn =
|
auto lookupConformanceFn =
|
||||||
@@ -146,9 +146,9 @@ Solution::computeSubstitutions(NullablePtr<ValueDecl> decl,
|
|||||||
return conformance;
|
return conformance;
|
||||||
};
|
};
|
||||||
|
|
||||||
return SubstitutionMap::get(sig,
|
auto subs = SubstitutionMap::get(sig, replacementTypes, lookupConformanceFn);
|
||||||
replacementTypes,
|
ASSERT(!subs.getRecursiveProperties().isSolverAllocated());
|
||||||
lookupConformanceFn);
|
return subs;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Lazily instantiate function definitions for class template specializations.
|
// Lazily instantiate function definitions for class template specializations.
|
||||||
|
|||||||
6
test/Constraints/rdar154553285.swift
Normal file
6
test/Constraints/rdar154553285.swift
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
// RUN: %target-typecheck-verify-swift -disable-experimental-parser-round-trip
|
||||||
|
|
||||||
|
// Make sure we don't crash
|
||||||
|
func testInvalidInInterpolation(_ x: Int) {
|
||||||
|
_ = "\((x, \[]))" // expected-error {{invalid component of Swift key path}}
|
||||||
|
}
|
||||||
@@ -1,7 +1,4 @@
|
|||||||
// {"signature":"swift::ProtocolConformanceRef::forAbstract(swift::Type, swift::ProtocolDecl*)"}
|
// {"signature":"swift::ProtocolConformanceRef::forAbstract(swift::Type, swift::ProtocolDecl*)"}
|
||||||
// RUN: env DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib not --crash %target-swift-frontend -typecheck %s
|
// RUN: not %target-swift-frontend -typecheck %s
|
||||||
// REQUIRES: OS=macosx
|
|
||||||
// REQUIRES: target-same-as-host
|
|
||||||
// REQUIRES: no_asan
|
|
||||||
var sixDoubles
|
var sixDoubles
|
||||||
: Double "six has the value [\( ( sixDoubles \[]) }0 \0\0 \0 \sixDoubles)"
|
: Double "six has the value [\( ( sixDoubles \[]) }0 \0\0 \0 \sixDoubles)"
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
// {"signature":"swift::FunctionType::get(llvm::ArrayRef<swift::AnyFunctionType::Param>, swift::Type, std::__1::optional<swift::ASTExtInfo>)"}
|
// {"signature":"swift::FunctionType::get(llvm::ArrayRef<swift::AnyFunctionType::Param>, swift::Type, std::__1::optional<swift::ASTExtInfo>)"}
|
||||||
// RUN: not --crash %target-swift-frontend -typecheck %s
|
// RUN: not %target-swift-frontend -typecheck %s
|
||||||
struct a < b : FixedWidthInteger extension a : Sequence {
|
struct a < b : FixedWidthInteger extension a : Sequence {
|
||||||
c {
|
c {
|
||||||
{ for
|
{ for
|
||||||
Reference in New Issue
Block a user