Skip to content

Commit f9c920f

Browse files
Merge pull request #4516 from swiftwasm/main
[pull] swiftwasm from main
2 parents 5b0dc99 + 223d73c commit f9c920f

File tree

168 files changed

+2185
-716
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

168 files changed

+2185
-716
lines changed

CHANGELOG.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -813,7 +813,7 @@ Swift 5.5
813813
}
814814

815815

816-
func hadWithdrawlOn(_ day: Date, from acct: BankAccount) async -> Bool {
816+
func hadWithdrawalOn(_ day: Date, from acct: BankAccount) async -> Bool {
817817
return await !acct[day].allSatisfy { $0.amount >= Amount.zero }
818818
// ^~~~~~~~~ this access is async
819819
}
@@ -2788,7 +2788,7 @@ Swift 3.1
27882788
result in a compilation error.
27892789

27902790
Examples of functions that "return twice" include `vfork` and `setjmp`.
2791-
These functions change the control flow of a program in ways that that Swift
2791+
These functions change the control flow of a program in ways that Swift
27922792
has never supported. For example, definitive initialization of variables,
27932793
a core Swift language feature, could not be guaranteed when these functions
27942794
were used.
@@ -9098,7 +9098,7 @@ Swift 1.0
90989098
[SE-0107]: <https://github.com/apple/swift-evolution/blob/main/proposals/0107-unsaferawpointer.md>
90999099
[SE-0108]: <https://github.com/apple/swift-evolution/blob/main/proposals/0108-remove-assoctype-inference.md>
91009100
[SE-0109]: <https://github.com/apple/swift-evolution/blob/main/proposals/0109-remove-boolean.md>
9101-
[SE-0110]: <https://github.com/apple/swift-evolution/blob/main/proposals/0110-distingish-single-tuple-arg.md>
9101+
[SE-0110]: <https://github.com/apple/swift-evolution/blob/main/proposals/0110-distinguish-single-tuple-arg.md>
91029102
[SE-0111]: <https://github.com/apple/swift-evolution/blob/main/proposals/0111-remove-arg-label-type-significance.md>
91039103
[SE-0112]: <https://github.com/apple/swift-evolution/blob/main/proposals/0112-nserror-bridging.md>
91049104
[SE-0113]: <https://github.com/apple/swift-evolution/blob/main/proposals/0113-rounding-functions-on-floatingpoint.md>

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ to track the status of our builds, please refer to our [GitHub Actions page](htt
3737
| **OS** | **Architecture** | **Build** |
3838
|---|:---:|:---:|
3939
|**[Ubuntu 16.04 ](https://github.com/apple/swift-community-hosted-continuous-integration/blob/main/nodes/ppc64le_ubuntu_16_04.json)** | PPC64LE |[![Build Status](https://ci-external.swift.org/job/oss-swift-5.1-RA-linux-ubuntu-16.04-ppc64le/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-5.1-RA-linux-ubuntu-16.04-ppc64le)|
40-
|**[Ubuntu 18.04](https://github.com/apple/swift-community-hosted-continuous-integration/blob/main/nodes/aarch64_ubuntu_18.04_docker.json)** | AArch64 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-ubuntu-18.04-aarch64/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-ubuntu-18.04-aarch64)|
41-
|**[Ubuntu 20.04](https://github.com/apple/swift-community-hosted-continuous-integration/blob/main/nodes/aarch64_ubuntu_20.04_docker.json)** | AArch64 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-ubuntu-20.04-aarch64/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-ubuntu-20.04-aarch64)|
4240
|**[Ubuntu 20.04](https://github.com/apple/swift-community-hosted-continuous-integration/blob/main/nodes/wasm32_ubuntu_20.04.json)** | wasm32 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-20.04-webassembly/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-20.04-webassembly)|
4341
|**[Android](https://github.com/apple/swift-community-hosted-continuous-integration/blob/main/nodes/x86_64_ubuntu_16_04_LTS_android.json)** | ARMv7 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-android/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-android)|
4442
|**[Android](https://github.com/apple/swift-community-hosted-continuous-integration/blob/main/nodes/x86_64_ubuntu_16_04_LTS_android.json)** | AArch64 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-android-arm64/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-android-arm64)|

SwiftCompilerSources/CMakeLists.txt

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,27 @@ function(add_swift_compiler_modules_library name)
8989

9090
if(SWIFT_HOST_VARIANT_SDK IN_LIST SWIFT_DARWIN_PLATFORMS)
9191
set(deployment_version "${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_DEPLOYMENT_VERSION}")
92-
set(sdk_option "-sdk" "${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_ARCH_${SWIFT_HOST_VARIANT_ARCH}_PATH}")
92+
set(sdk_path "${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_ARCH_${SWIFT_HOST_VARIANT_ARCH}_PATH}")
93+
set(sdk_option "-sdk" "${sdk_path}")
9394
if(${BOOTSTRAPPING_MODE} STREQUAL "CROSSCOMPILE-WITH-HOSTLIBS")
9495
# Let the cross-compiled compile don't pick up the compiled stdlib by providing
9596
# an (almost) empty resource dir.
9697
# The compiler will instead pick up the stdlib from the SDK.
9798
get_filename_component(swift_exec_bin_dir ${ALS_SWIFT_EXEC} DIRECTORY)
9899
set(sdk_option ${sdk_option} "-resource-dir" "${swift_exec_bin_dir}/../bootstrapping0/lib/swift")
99100
endif()
101+
if(NOT EXISTS "${sdk_path}/usr/include/c++")
102+
# Darwin SDKs in Xcode 12 or older do not include libc++, which prevents clang from finding libc++ when invoked
103+
# from ClangImporter. This results in build errors. To workaround this, let's explicitly pass the path to libc++
104+
# to clang.
105+
message(WARNING "Building with an outdated Darwin SDK: libc++ missing from the ${SWIFT_HOST_VARIANT_SDK} SDK. Will use libc++ from the toolchain.")
106+
get_filename_component(absolute_libcxx_path "${CMAKE_C_COMPILER}/../../include/c++/v1" REALPATH)
107+
if (EXISTS "${absolute_libcxx_path}")
108+
set(sdk_option ${sdk_option} "-Xcc" "-isystem" "-Xcc" "${absolute_libcxx_path}")
109+
else()
110+
message(ERROR "libc++ not found in the toolchain.")
111+
endif()
112+
endif()
100113
elseif(${BOOTSTRAPPING_MODE} STREQUAL "CROSSCOMPILE")
101114
set(sdk_option "-sdk" "${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_ARCH_${SWIFT_HOST_VARIANT_ARCH}_PATH}")
102115
get_filename_component(swift_exec_bin_dir ${ALS_SWIFT_EXEC} DIRECTORY)
@@ -212,6 +225,10 @@ else()
212225
list(APPEND b0_deps swiftDarwin-bootstrapping0)
213226
list(APPEND b1_deps swiftDarwin-bootstrapping1)
214227
endif()
228+
if(${SWIFT_HOST_VARIANT_SDK} IN_LIST SWIFT_LIBSTDCXX_PLATFORMS)
229+
list(APPEND b0_deps copy-libstdcxx-modulemap-bootstrapping0 copy-libstdcxx-header-bootstrapping0)
230+
list(APPEND b1_deps copy-libstdcxx-modulemap-bootstrapping1 copy-libstdcxx-header-bootstrapping1)
231+
endif()
215232
endif()
216233
if(SWIFT_HOST_VARIANT_SDK IN_LIST SWIFT_DARWIN_PLATFORMS)
217234
set(platform ${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR})
@@ -252,22 +269,23 @@ else()
252269
endif()
253270

254271
# Configure 'SwiftCompilerModules' SwiftPM package. The 'Package.swift' will
255-
# be created at '${build_dir}/SwiftCompilerSources/Package.swift' and can be
256-
# built with 'swift-build'.
272+
# be created at '${build_dir}/SwiftCompilerModulesPackage/Package.swift' and can
273+
# be built with 'swift-build'.
257274
# Note that this SwiftPM package itself is just for development purposes, and
258275
# is not actually used for the compiler building.
259-
set(swiftcompiler_source_dir_name "_Sources")
276+
set(swiftcompiler_modules_package_directory
277+
"${SWIFT_BINARY_DIR}/SwiftCompilerModulesPackage")
260278
configure_file(Package.swift.in
261-
"${CMAKE_CURRENT_BINARY_DIR}/Package.swift" @ONLY)
279+
"${swiftcompiler_modules_package_directory}/Package.swift" @ONLY)
262280
# SwiftPM requires all sources are inside the directory of 'Package.swift'.
263281
# Create symlinks to the actual source directories.
264282
execute_process(COMMAND
265283
"${CMAKE_COMMAND}" -E create_symlink
266284
"${CMAKE_CURRENT_SOURCE_DIR}/Sources"
267-
"${CMAKE_CURRENT_BINARY_DIR}/${swiftcompiler_source_dir_name}")
285+
"${swiftcompiler_modules_package_directory}/Sources")
268286
if(SWIFT_BUILD_REGEX_PARSER_IN_COMPILER)
269287
execute_process(COMMAND
270288
"${CMAKE_COMMAND}" -E create_symlink
271289
"${EXPERIMENTAL_STRING_PROCESSING_SOURCE_DIR}/Sources/_RegexParser"
272-
"${CMAKE_CURRENT_BINARY_DIR}/_RegexParser_Sources")
290+
"${swiftcompiler_modules_package_directory}/_RegexParser_Sources")
273291
endif()

SwiftCompilerSources/Package.swift.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ private extension Target {
3939
.target(
4040
name: name,
4141
dependencies: dependencies,
42-
path: path ?? "@swiftcompiler_source_dir_name@/\(name)",
42+
path: path ?? "Sources/\(name)",
4343
exclude: ["CMakeLists.txt"],
4444
sources: sources,
4545
swiftSettings: defaultSwiftSettings + swiftSettings)

SwiftCompilerSources/Sources/Basic/SourceLoc.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===--- SourceLoc.swift - SourceLoc bridiging utilities ------------------===//
1+
//===--- SourceLoc.swift - SourceLoc bridging utilities ------------------===//
22
//
33
// This source file is part of the Swift.org open source project
44
//

SwiftCompilerSources/Sources/SIL/BasicBlock.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ final public class BasicBlock : ListNode, CustomStringConvertible, HasName {
2525
public var function: Function { SILBasicBlock_getFunction(bridged).function }
2626

2727
public var description: String {
28-
SILBasicBlock_debugDescription(bridged).takeString()
28+
var s = SILBasicBlock_debugDescription(bridged)
29+
return String(cString: s.c_str())
2930
}
3031

3132
public var arguments: ArgumentArray { ArgumentArray(block: self) }

SwiftCompilerSources/Sources/SIL/Function.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ final public class Function : CustomStringConvertible, HasName {
2121
}
2222

2323
final public var description: String {
24-
return SILFunction_debugDescription(bridged).takeString()
24+
var s = SILFunction_debugDescription(bridged)
25+
return String(cString: s.c_str())
2526
}
2627

2728
public var entryBlock: BasicBlock {

SwiftCompilerSources/Sources/SIL/GlobalVariable.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ final public class GlobalVariable : CustomStringConvertible, HasName {
1919
}
2020

2121
public var description: String {
22-
return SILGlobalVariable_debugDescription(bridged).takeString()
22+
var s = SILGlobalVariable_debugDescription(bridged)
23+
return String(cString: s.c_str())
2324
}
2425

2526
// TODO: initializer instructions

SwiftCompilerSources/Sources/SIL/Instruction.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ public class Instruction : ListNode, CustomStringConvertible, Hashable {
3838
final public var function: Function { block.function }
3939

4040
final public var description: String {
41-
SILNode_debugDescription(bridgedNode).takeString()
41+
var s = SILNode_debugDescription(bridgedNode)
42+
return String(cString: s.c_str())
4243
}
4344

4445
final public var operands: OperandArray {
@@ -135,7 +136,8 @@ public class SingleValueInstruction : Instruction, Value {
135136

136137
public final class MultipleValueInstructionResult : Value {
137138
final public var description: String {
138-
SILNode_debugDescription(bridgedNode).takeString()
139+
var s = SILNode_debugDescription(bridgedNode)
140+
return String(cString: s.c_str())
139141
}
140142

141143
public var instruction: Instruction {

SwiftCompilerSources/Sources/SIL/Value.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ public protocol Value : AnyObject, CustomStringConvertible {
2121

2222
extension Value {
2323
public var description: String {
24-
SILNode_debugDescription(bridgedNode).takeString()
24+
var s = SILNode_debugDescription(bridgedNode)
25+
return String(cString: s.c_str())
2526
}
2627

2728
public var uses: UseList {

cmake/modules/AddSwift.cmake

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ include(SwiftList)
33
include(SwiftXcodeSupport)
44
include(SwiftWindowsSupport)
55
include(SwiftAndroidSupport)
6+
include(SwiftCXXUtils)
67

78
function(_swift_gyb_target_sources target scope)
89
file(GLOB GYB_UNICODE_DATA ${SWIFT_SOURCE_DIR}/utils/UnicodeData/*)
@@ -720,7 +721,7 @@ function(add_swift_host_tool executable)
720721
721722
elseif(BOOTSTRAPPING_MODE STREQUAL "CROSSCOMPILE-WITH-HOSTLIBS")
722723
723-
# Intentinally don't add the lib dir of the cross-compiled compiler, so that
724+
# Intentionally don't add the lib dir of the cross-compiled compiler, so that
724725
# the stdlib is not picked up from there, but from the SDK.
725726
# This requires to explicitly add all the needed compatibility libraries. We
726727
# can take them from the current build.
@@ -787,7 +788,7 @@ function(add_swift_host_tool executable)
787788
elseif(SWIFT_HOST_VARIANT_SDK MATCHES "LINUX|ANDROID|OPENBSD" AND ASHT_HAS_SWIFT_MODULES AND BOOTSTRAPPING_MODE)
788789
set(swiftrt "swiftImageRegistrationObject${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_OBJECT_FORMAT}-${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR}-${SWIFT_HOST_VARIANT_ARCH}")
789790
if(${BOOTSTRAPPING_MODE} MATCHES "HOSTTOOLS|CROSSCOMPILE")
790-
# At build time and and run time, link against the swift libraries in the
791+
# At build time and run time, link against the swift libraries in the
791792
# installed host toolchain.
792793
get_filename_component(swift_bin_dir ${SWIFT_EXEC_FOR_SWIFT_MODULES} DIRECTORY)
793794
get_filename_component(swift_dir ${swift_bin_dir} DIRECTORY)

cmake/modules/SwiftCXXUtils.cmake

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Platforms that use libstdc++ as the system-wide default C++ standard library.
2+
set(SWIFT_LIBSTDCXX_PLATFORMS
3+
"LINUX"
4+
"FREEBSD"
5+
"OPENBSD"
6+
"CYGWIN"
7+
"HAIKU")

cmake/modules/SwiftConfigureSDK.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ function(remove_sdk_unsupported_archs name os sdk_path architectures_var)
9090
message(STATUS "Assuming ${name} SDK at ${sdk_path} supports architecture ${arch}")
9191
list(APPEND architectures ${arch})
9292
elseif(arch STREQUAL "i386" AND os STREQUAL "iphonesimulator")
93-
# 32-bit iOS simulatoris not listed explicitly in SDK settings.
93+
# 32-bit iOS simulator is not listed explicitly in SDK settings.
9494
message(STATUS "Assuming ${name} SDK at ${sdk_path} supports architecture ${arch}")
9595
list(APPEND architectures ${arch})
9696
else()

include/swift/ABI/Metadata.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -877,7 +877,7 @@ struct TargetClassMetadata : public TargetAnyClassMetadataVariant {
877877
//
878878
// Using Objective-C runtime, KVO can modify object behavior without needing
879879
// to modify the object's code. This is done by dynamically creating an
880-
// artificial subclass of the the object's type.
880+
// artificial subclass of the object's type.
881881
//
882882
// The isa pointer of the observed object is swapped out to point to
883883
// the artificial subclass, which has the following properties:

include/swift/ABI/TaskOptions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class TaskGroupTaskOptionRecord : public TaskOptionRecord {
7878

7979
/// Task option to specify on what executor the task should be executed.
8080
///
81-
/// Not passing this option implies that that a "best guess" or good default
81+
/// Not passing this option implies that a "best guess" or good default
8282
/// executor should be used instead, most often this may mean the global
8383
/// concurrent executor, or the enclosing actor's executor.
8484
class ExecutorTaskOptionRecord : public TaskOptionRecord {

include/swift/AST/ASTContext.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -868,6 +868,10 @@ class ASTContext final {
868868
/// swift_isUniquelyReferenced functions.
869869
AvailabilityContext getObjCIsUniquelyReferencedAvailability();
870870

871+
/// Get the runtime availability of metadata manipulation runtime functions
872+
/// for extended existential types.
873+
AvailabilityContext getParameterizedExistentialRuntimeAvailability();
874+
871875
/// Get the runtime availability of features introduced in the Swift 5.2
872876
/// compiler for the target platform.
873877
AvailabilityContext getSwift52Availability();

include/swift/AST/DiagnosticsFrontend.def

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,8 @@ WARNING(emit_reference_dependencies_without_primary_file,none,
149149

150150
WARNING(warn_implicit_concurrency_import_failed,none,
151151
"unable to perform implicit import of \"_Concurrency\" module: no such module found", ())
152-
WARNING(warn_implicit_string_processing_import_failed,none,
153-
"unable to perform implicit import of \"_StringProcessing\" module: no such module found", ())
152+
REMARK(warn_implicit_string_processing_import_failed,none,
153+
"unable to perform implicit import of \"_StringProcessing\" module: no such module found", ())
154154

155155
ERROR(error_module_name_required,none, "-module-name is required", ())
156156
ERROR(error_bad_module_name,none,

include/swift/AST/DiagnosticsSema.def

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5032,6 +5032,9 @@ ERROR(unable_to_parse_c_function_type,none,
50325032
ERROR(unsupported_opaque_type,none,
50335033
"'some' types are only permitted in properties, subscripts, and functions", ())
50345034

5035+
ERROR(unsupported_opaque_type_in_existential,none,
5036+
"'some' types cannot be used in constraints on existential types", ())
5037+
50355038
ERROR(opaque_type_unsupported_pattern,none,
50365039
"'some' type can only be declared on a single property declaration", ())
50375040

@@ -5581,6 +5584,10 @@ ERROR(availability_decl_only_version_newer, none,
55815584
"%0 is only available in %1 %2 or newer",
55825585
(DeclName, StringRef, llvm::VersionTuple))
55835586

5587+
WARNING(availability_decl_only_version_newer_warn, none,
5588+
"%0 is only available in %1 %2 or newer",
5589+
(DeclName, StringRef, llvm::VersionTuple))
5590+
55845591
ERROR(availability_opaque_types_only_version_newer, none,
55855592
"'some' return types are only available in %0 %1 or newer",
55865593
(StringRef, llvm::VersionTuple))
@@ -5589,6 +5596,11 @@ ERROR(availability_concurrency_only_version_newer, none,
55895596
"concurrency is only available in %0 %1 or newer",
55905597
(StringRef, llvm::VersionTuple))
55915598

5599+
ERROR(availability_parameterized_protocol_only_version_newer, none,
5600+
"runtime support for parameterized protocol types is only available in "
5601+
"%0 %1 or newer",
5602+
(StringRef, llvm::VersionTuple))
5603+
55925604
NOTE(availability_guard_with_version_check, none,
55935605
"add 'if #available' version check", ())
55945606

include/swift/AST/TypeCheckRequests.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2264,7 +2264,7 @@ class ResultTypeRequest
22642264
class PatternBindingEntryRequest
22652265
: public SimpleRequest<PatternBindingEntryRequest,
22662266
const PatternBindingEntry *(PatternBindingDecl *,
2267-
unsigned),
2267+
unsigned, bool),
22682268
RequestFlags::SeparatelyCached> {
22692269
public:
22702270
using SimpleRequest::SimpleRequest;
@@ -2273,8 +2273,9 @@ class PatternBindingEntryRequest
22732273
friend SimpleRequest;
22742274

22752275
// Evaluation.
2276-
const PatternBindingEntry *
2277-
evaluate(Evaluator &evaluator, PatternBindingDecl *PBD, unsigned i) const;
2276+
const PatternBindingEntry *evaluate(Evaluator &evaluator,
2277+
PatternBindingDecl *PBD, unsigned i,
2278+
bool LeaveClosureBodiesUnchecked) const;
22782279

22792280
public:
22802281
// Separate caching.

include/swift/AST/TypeCheckerTypeIDZone.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ SWIFT_REQUEST(TypeChecker, OverriddenDeclsRequest,
266266
llvm::TinyPtrVector<ValueDecl *>(ValueDecl *), SeparatelyCached,
267267
NoLocationInfo)
268268
SWIFT_REQUEST(TypeChecker, PatternBindingEntryRequest,
269-
const PatternBindingEntry *(PatternBindingDecl *, unsigned),
269+
const PatternBindingEntry *(PatternBindingDecl *, unsigned, bool),
270270
SeparatelyCached, NoLocationInfo)
271271
SWIFT_REQUEST(TypeChecker, PrimarySourceFilesRequest,
272272
ArrayRef<SourceFile *>(ModuleDecl *), Cached, NoLocationInfo)

include/swift/AST/Types.h

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,10 @@ class RecursiveTypeProperties {
163163
/// type sequence
164164
HasTypeSequence = 0x1000,
165165

166-
Last_Property = HasTypeSequence
166+
/// This type contains a parameterized existential type \c any P<T>.
167+
HasParameterizedExistential = 0x2000,
168+
169+
Last_Property = HasParameterizedExistential
167170
};
168171
enum { BitWidth = countBitsUsed(Property::Last_Property) };
169172

@@ -223,6 +226,12 @@ class RecursiveTypeProperties {
223226

224227
bool hasTypeSequence() const { return Bits & HasTypeSequence; }
225228

229+
/// Does a type with these properties structurally contain a
230+
/// parameterized existential type?
231+
bool hasParameterizedExistential() const {
232+
return Bits & HasParameterizedExistential;
233+
}
234+
226235
/// Returns the set of properties present in either set.
227236
friend RecursiveTypeProperties operator|(Property lhs, Property rhs) {
228237
return RecursiveTypeProperties(unsigned(lhs) | unsigned(rhs));
@@ -626,6 +635,11 @@ class alignas(1 << TypeAlignInBits) TypeBase
626635
return getRecursiveProperties().hasTypeSequence();
627636
}
628637

638+
/// Determine whether the type involves a parameterized existential type.
639+
bool hasParameterizedExistential() const {
640+
return getRecursiveProperties().hasParameterizedExistential();
641+
}
642+
629643
/// Determine whether the type involves the given opened existential
630644
/// archetype.
631645
bool hasOpenedExistentialWithRoot(const OpenedArchetypeType *root) const;

include/swift/Basic/BasicSourceInfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class BasicSourceFileInfo {
8383

8484
/// Construct with a `SourceFile`. `getInterfaceHashIncludingTypeMembers()`,
8585
/// `getInterfaceHashExcludingTypeMembers()`, `getLastModified()` and
86-
/// `getFileSize()` are laizily populated when accessed.
86+
/// `getFileSize()` are lazily populated when accessed.
8787
BasicSourceFileInfo(const SourceFile *SF);
8888

8989
bool isFromSourceFile() const;

0 commit comments

Comments
 (0)