Skip to content

Commit 5a196c7

Browse files
authored
Merge pull request #1560 from swiftwasm/maxd/fix-5.3
Fix CI issues in the 5.3 branch
2 parents bf51b9a + 63d94c8 commit 5a196c7

File tree

121 files changed

+3054
-938
lines changed

Some content is hidden

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

121 files changed

+3054
-938
lines changed

include/swift/AST/Decl.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3594,6 +3594,8 @@ class NominalTypeDecl : public GenericTypeDecl, public IterableDeclContext {
35943594
/// initializer.
35953595
bool hasDefaultInitializer() const;
35963596

3597+
bool isTypeErasedGenericClass() const;
3598+
35973599
/// Retrieves the synthesized zero parameter default initializer for this
35983600
/// declaration, or \c nullptr if it doesn't have one.
35993601
ConstructorDecl *getDefaultInitializer() const;

include/swift/AST/DiagnosticsSema.def

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1174,6 +1174,12 @@ ERROR(extra_trailing_closure_in_call,none,
11741174
ERROR(trailing_closure_bad_param,none,
11751175
"trailing closure passed to parameter of type %0 that does not "
11761176
"accept a closure", (Type))
1177+
WARNING(unlabeled_trailing_closure_deprecated,none,
1178+
"backward matching of the unlabeled trailing closure is deprecated; label the argument with %0 to suppress this warning",
1179+
(Identifier))
1180+
NOTE(decl_multiple_defaulted_closure_parameters,none,
1181+
"%0 contains defaulted closure parameters %1 and %2",
1182+
(DeclName, Identifier, Identifier))
11771183
NOTE(candidate_with_extraneous_args,none,
11781184
"candidate %0 requires %1 argument%s1, "
11791185
"but %2 %select{were|was}3 %select{provided|used in closure body}4",
@@ -2678,6 +2684,12 @@ ERROR(decl_from_hidden_module,none,
26782684
"%select{%3 has been imported as implementation-only|"
26792685
"it is an SPI imported from %3}4",
26802686
(DescriptiveDeclKind, DeclName, unsigned, Identifier, unsigned))
2687+
WARNING(decl_from_hidden_module_warn,none,
2688+
"cannot use %0 %1 %select{in SPI|as property wrapper in SPI|"
2689+
"in an extension with public or '@usableFromInline' members|"
2690+
"in an extension with conditional conformances}2; "
2691+
"%select{%3 has been imported as implementation-only}4",
2692+
(DescriptiveDeclKind, DeclName, unsigned, Identifier, unsigned))
26812693
ERROR(conformance_from_implementation_only_module,none,
26822694
"cannot use conformance of %0 to %1 %select{here|as property wrapper here|"
26832695
"in an extension with public or '@usableFromInline' members|"

include/swift/AST/Type.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,7 @@ class CanType : public Type {
389389
static bool isExistentialTypeImpl(CanType type);
390390
static bool isAnyExistentialTypeImpl(CanType type);
391391
static bool isObjCExistentialTypeImpl(CanType type);
392+
static bool isTypeErasedGenericClassTypeImpl(CanType type);
392393
static CanType getOptionalObjectTypeImpl(CanType type);
393394
static CanType getReferenceStorageReferentImpl(CanType type);
394395
static CanType getWithoutSpecifierTypeImpl(CanType type);
@@ -475,6 +476,11 @@ class CanType : public Type {
475476
return isObjCExistentialTypeImpl(*this);
476477
}
477478

479+
// Is this an ObjC generic class.
480+
bool isTypeErasedGenericClassType() const {
481+
return isTypeErasedGenericClassTypeImpl(*this);
482+
}
483+
478484
ClassDecl *getClassOrBoundGenericClass() const; // in Types.h
479485
StructDecl *getStructOrBoundGenericStruct() const; // in Types.h
480486
EnumDecl *getEnumOrBoundGenericEnum() const; // in Types.h

include/swift/AST/Types.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3484,6 +3484,7 @@ END_CAN_TYPE_WRAPPER(FunctionType, AnyFunctionType)
34843484
/// has a default argument.
34853485
struct ParameterListInfo {
34863486
SmallBitVector defaultArguments;
3487+
SmallBitVector acceptsUnlabeledTrailingClosures;
34873488

34883489
public:
34893490
ParameterListInfo() { }
@@ -3494,6 +3495,10 @@ struct ParameterListInfo {
34943495
/// Whether the parameter at the given index has a default argument.
34953496
bool hasDefaultArgument(unsigned paramIdx) const;
34963497

3498+
/// Whether the parameter accepts an unlabeled trailing closure argument
3499+
/// according to the "forward-scan" rule.
3500+
bool acceptsUnlabeledTrailingClosureArgument(unsigned paramIdx) const;
3501+
34973502
/// Retrieve the number of non-defaulted parameters.
34983503
unsigned numNonDefaultedParameters() const {
34993504
return defaultArguments.count();

include/swift/Basic/LangOptions.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,14 @@ namespace swift {
250250
/// Build the ASTScope tree lazily
251251
bool LazyASTScopes = true;
252252

253+
/// Whether to enable the "fuzzy" forward-scanning behavior for trailing
254+
/// closure matching, which skips over defaulted closure parameters
255+
/// to match later (non-defaulted) closure parameters
256+
///
257+
/// This is a backward-compatibility hack for unlabeled trailing closures,
258+
/// to be disabled in Swift 6+.
259+
bool EnableFuzzyForwardScanTrailingClosureMatching = true;
260+
253261
/// Use Clang function types for computing canonical types.
254262
/// If this option is false, the clang function types will still be computed
255263
/// but will not be used for checking type equality.
@@ -350,6 +358,9 @@ namespace swift {
350358
/// If set to \c false, fall back to the legacy manual reference name tracking code.
351359
bool EnableRequestBasedIncrementalDependencies = true;
352360

361+
/// Load swiftmodule files in memory as volatile and avoid mmap.
362+
bool EnableVolatileModules = false;
363+
353364
/// Sets the target we are building for and updates platform conditions
354365
/// to match.
355366
///

include/swift/Basic/Platform.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,6 @@ namespace swift {
7171
/// Returns the platform Kind for Darwin triples.
7272
DarwinPlatformKind getDarwinPlatformKind(const llvm::Triple &triple);
7373

74-
/// Maps an arbitrary platform to its non-simulator equivalent.
75-
///
76-
/// If \p platform is not a simulator platform, it will be returned as is.
77-
DarwinPlatformKind getNonSimulatorPlatform(DarwinPlatformKind platform);
78-
7974
/// Returns the architecture component of the path for a given target triple.
8075
///
8176
/// Typically this is used for mapping the architecture component of the

include/swift/Option/FrontendOptions.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,9 @@ def warn_long_expression_type_checking_EQ : Joined<["-"], "warn-long-expression-
455455
def Rmodule_interface_rebuild : Flag<["-"], "Rmodule-interface-rebuild">,
456456
HelpText<"Emits a remark if an imported module needs to be re-compiled from its module interface">;
457457

458+
def enable_volatile_modules : Flag<["-"], "enable-volatile-modules">,
459+
HelpText<"Load Swift modules in memory">;
460+
458461
def solver_expression_time_threshold_EQ : Joined<["-"], "solver-expression-time-threshold=">;
459462

460463
def solver_disable_shrink :

include/swift/Option/Options.td

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,16 @@ def enable_experimental_concise_pound_file : Flag<["-"],
519519
Flags<[FrontendOption, ModuleInterfaceOption]>,
520520
HelpText<"Enable experimental concise '#file' identifier">;
521521

522+
def disable_fuzzy_forward_scan_trailing_closure_matching : Flag<["-"],
523+
"disable-fuzzy-forward-scan-trailing-closure-matching">,
524+
Flags<[FrontendOption]>,
525+
HelpText<"Disable fuzzy forward-scan trailing closure matching">;
526+
527+
def enable_fuzzy_forward_scan_trailing_closure_matching : Flag<["-"],
528+
"enable-fuzzy-forward-scan-trailing-closure-matching">,
529+
Flags<[FrontendOption]>,
530+
HelpText<"Enable fuzzy forward-scan trailing closure matching">;
531+
522532
// Diagnostic control options
523533
def suppress_warnings : Flag<["-"], "suppress-warnings">,
524534
Flags<[FrontendOption]>,

include/swift/Runtime/RuntimeFunctions.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1172,7 +1172,7 @@ FUNCTION(ConformsToProtocol,
11721172

11731173
// bool swift_isClassType(type*);
11741174
FUNCTION(IsClassType,
1175-
swift_isClassType, C_CC, AlwaysAvailable,
1175+
swift_isClassType, SwiftCC, AlwaysAvailable,
11761176
RETURNS(Int1Ty),
11771177
ARGS(TypeMetadataPtrTy),
11781178
ATTRS(ZExt, NoUnwind, ReadNone))

lib/AST/Decl.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4190,6 +4190,14 @@ bool NominalTypeDecl::hasDefaultInitializer() const {
41904190
false);
41914191
}
41924192

4193+
bool NominalTypeDecl::isTypeErasedGenericClass() const {
4194+
// ObjC classes are type erased.
4195+
// TODO: Unless they have magic methods...
4196+
if (auto clas = dyn_cast<ClassDecl>(this))
4197+
return clas->hasClangNode() && clas->isGenericContext();
4198+
return false;
4199+
}
4200+
41934201
ConstructorDecl *NominalTypeDecl::getDefaultInitializer() const {
41944202
if (!hasDefaultInitializer())
41954203
return nullptr;

0 commit comments

Comments
 (0)