Skip to content

Commit 6d02d07

Browse files
Merge pull request #4760 from swiftwasm/main
[pull] swiftwasm from main
2 parents b024c81 + b0fb7c5 commit 6d02d07

Some content is hidden

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

43 files changed

+500
-223
lines changed

include/swift/AST/DiagnosticsSema.def

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4788,6 +4788,9 @@ ERROR(nonisolated_local_var,none,
47884788
ERROR(nonisolated_actor_sync_init,none,
47894789
"'nonisolated' on an actor's synchronous initializer is invalid",
47904790
())
4791+
ERROR(nonisolated_wrapped_property,none,
4792+
"'nonisolated' is not supported on properties with property wrappers",
4793+
())
47914794

47924795
ERROR(actor_instance_property_wrapper,none,
47934796
"%0 property in property wrapper type %1 cannot be isolated to "

include/swift/Basic/LLVM.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@
2525
// None.h includes an enumerator that is desired & cannot be forward declared
2626
// without a definition of NoneType.
2727
#include "llvm/ADT/None.h"
28+
#if defined(__clang_major__) && __clang_major__ < 6
29+
// Add this header as a workaround to prevent `too few template arguments for
30+
// class template 'SmallVector'` on the buggy Clang 5 compiler (it doesn't
31+
// merge template arguments correctly). Remove once the CentOS 7 job is
32+
// replaced.
33+
// rdar://98218902
34+
#include "llvm/ADT/SmallVector.h"
35+
#endif
2836

2937
// Don't pre-declare certain LLVM types in the runtime, which must
3038
// not put things in namespace llvm for ODR reasons.

include/swift/Sema/ConstraintLocatorPathElts.def

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,11 @@ CUSTOM_LOCATOR_PATH_ELT(ContextualType)
7272
/// A result of an expression involving dynamic lookup.
7373
SIMPLE_LOCATOR_PATH_ELT(DynamicLookupResult)
7474

75-
/// The superclass of a protocol existential type.
76-
SIMPLE_LOCATOR_PATH_ELT(ExistentialSuperclassType)
75+
/// The superclass of a protocol composition type.
76+
SIMPLE_LOCATOR_PATH_ELT(ProtocolCompositionSuperclassType)
77+
78+
/// The constraint of an existential type.
79+
SIMPLE_LOCATOR_PATH_ELT(ExistentialConstraintType)
7780

7881
/// The argument type of a function.
7982
SIMPLE_LOCATOR_PATH_ELT(FunctionArgument)

include/swift/Sema/ConstraintSystem.h

Lines changed: 90 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -946,6 +946,10 @@ struct AppliedBuilderTransform {
946946
Expr *returnExpr = nullptr;
947947
};
948948

949+
struct Score;
950+
/// Display a score.
951+
llvm::raw_ostream &operator<<(llvm::raw_ostream &out, const Score &score);
952+
949953
/// Describes the fixed score of a solution to the constraint system.
950954
struct Score {
951955
unsigned Data[NumScoreKinds] = {};
@@ -1016,11 +1020,94 @@ struct Score {
10161020
friend bool operator>=(const Score &x, const Score &y) {
10171021
return !(x < y);
10181022
}
1023+
1024+
/// Return ScoreKind descriptions for printing alongside non-zero ScoreKinds
1025+
/// in debug output.
1026+
static std::string getNameFor(ScoreKind kind) {
1027+
switch (kind) {
1028+
case SK_Hole:
1029+
return "hole";
10191030

1020-
};
1031+
case SK_Unavailable:
1032+
return "use of an unavailable declaration";
10211033

1022-
/// Display a score.
1023-
llvm::raw_ostream &operator<<(llvm::raw_ostream &out, const Score &score);
1034+
case SK_AsyncInSyncMismatch:
1035+
return "async-in-synchronous mismatch";
1036+
1037+
case SK_SyncInAsync:
1038+
return "sync-in-asynchronous";
1039+
1040+
case SK_ForwardTrailingClosure:
1041+
return "forward scan when matching a trailing closure";
1042+
1043+
case SK_Fix:
1044+
return "applied fix";
1045+
1046+
case SK_DisfavoredOverload:
1047+
return "disfavored overload";
1048+
1049+
case SK_UnresolvedMemberViaOptional:
1050+
return "unwrapping optional at unresolved member base";
1051+
1052+
case SK_ForceUnchecked:
1053+
return "force of an implicitly unwrapped optional";
1054+
1055+
case SK_UserConversion:
1056+
return "user conversion";
1057+
1058+
case SK_FunctionConversion:
1059+
return "function conversion";
1060+
1061+
case SK_NonDefaultLiteral:
1062+
return "non-default literal";
1063+
1064+
case SK_CollectionUpcastConversion:
1065+
return "collection upcast conversion";
1066+
1067+
case SK_ValueToOptional:
1068+
return "value to optional promotion";
1069+
1070+
case SK_EmptyExistentialConversion:
1071+
return "empty-existential conversion";
1072+
1073+
case SK_KeyPathSubscript:
1074+
return "key path subscript";
1075+
1076+
case SK_ValueToPointerConversion:
1077+
return "value-to-pointer conversion";
1078+
1079+
case SK_FunctionToAutoClosureConversion:
1080+
return "function to autoclosure parameter conversion";
1081+
1082+
case SK_ImplicitValueConversion:
1083+
return "value-to-value conversion";
1084+
1085+
case SK_UnappliedFunction:
1086+
return "use of overloaded unapplied function";
1087+
}
1088+
}
1089+
1090+
/// Print Score list a with brief description of any non-zero ScoreKinds.
1091+
void print(llvm::raw_ostream &out) const {
1092+
bool hasNonDefault = false;
1093+
for (unsigned int i = 0; i < NumScoreKinds; ++i) {
1094+
if (Data[i] != 0) {
1095+
out << " [";
1096+
out << getNameFor(ScoreKind(i));
1097+
out << "(s) = ";
1098+
out << std::to_string(Data[i]);
1099+
out << "]";
1100+
hasNonDefault = true;
1101+
}
1102+
}
1103+
1104+
if (!hasNonDefault) {
1105+
out << " <default ";
1106+
out << *this;
1107+
out << ">";
1108+
}
1109+
}
1110+
};
10241111

10251112
/// Describes a dependent type that has been opened to a particular type
10261113
/// variable.

include/swift/Sema/OverloadChoice.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,9 @@ class OverloadChoice {
310310
assert(isDecl() && "only makes sense for declaration choices");
311311
return TheFunctionRefKind;
312312
}
313+
314+
/// Print selected overload choice kind found for Solution in debug output.
315+
void dump(Type adjustedOpenedType, SourceManager *sm, raw_ostream &out) const;
313316
};
314317

315318
} // end namespace constraints

lib/AST/RequirementMachine/ConcreteContraction.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ Optional<Type> ConcreteContraction::substTypeParameterRec(
301301

302302
// An unresolved DependentMemberType stores an identifier. Handle this
303303
// by performing a name lookup into the base type.
304-
SmallVector<TypeDecl *, 2> concreteDecls;
304+
SmallVector<TypeDecl *> concreteDecls;
305305
lookupConcreteNestedType(*substBaseType, memberType->getName(), concreteDecls);
306306

307307
auto *typeDecl = findBestConcreteNestedType(concreteDecls);

lib/AST/Type.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -882,7 +882,7 @@ Type TypeBase::lookThroughAllOptionalTypes(SmallVectorImpl<Type> &optionals){
882882
}
883883

884884
unsigned int TypeBase::getOptionalityDepth() {
885-
SmallVector<Type, 4> types;
885+
SmallVector<Type> types;
886886
lookThroughAllOptionalTypes(types);
887887
return types.size();
888888
}

lib/ClangImporter/ClangDerivedConformances.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ static ValueDecl *getEqualEqualOperator(NominalTypeDecl *decl) {
8888
// If no member `func ==` was found, look for out-of-class definitions in the
8989
// same module.
9090
auto module = decl->getModuleContext();
91-
llvm::SmallVector<ValueDecl *> nonMemberResults;
91+
SmallVector<ValueDecl *> nonMemberResults;
9292
module->lookupValue(id, NLKind::UnqualifiedLookup, nonMemberResults);
9393
for (const auto &nonMember : nonMemberResults) {
9494
if (isValid(nonMember))

lib/Demangling/Demangler.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -561,9 +561,8 @@ Demangler::DemangleInitRAII::~DemangleInitRAII() {
561561
}
562562

563563
NodePointer Demangler::demangleSymbol(StringRef MangledName,
564-
std::function<SymbolicReferenceResolver_t> SymbolicReferenceResolver) {
565-
DemangleInitRAII state(*this, MangledName,
566-
std::move(SymbolicReferenceResolver));
564+
std::function<SymbolicReferenceResolver_t> Resolver) {
565+
DemangleInitRAII state(*this, MangledName, std::move(Resolver));
567566

568567
#if SWIFT_SUPPORT_OLD_MANGLING
569568
// Demangle old-style class and protocol names, which are still used in the
@@ -610,9 +609,8 @@ NodePointer Demangler::demangleSymbol(StringRef MangledName,
610609
}
611610

612611
NodePointer Demangler::demangleType(StringRef MangledName,
613-
std::function<SymbolicReferenceResolver_t> SymbolicReferenceResolver) {
614-
DemangleInitRAII state(*this, MangledName,
615-
std::move(SymbolicReferenceResolver));
612+
std::function<SymbolicReferenceResolver_t> Resolver) {
613+
DemangleInitRAII state(*this, MangledName, std::move(Resolver));
616614

617615
parseAndPushNodes();
618616

lib/DriverTool/swift_symbolgraph_extract_main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ int swift_symbolgraph_extract_main(ArrayRef<const char *> Args,
241241
// don't need to print these errors.
242242
CI.removeDiagnosticConsumer(&DiagPrinter);
243243

244-
SmallVector<ModuleDecl *, 8> Overlays;
244+
SmallVector<ModuleDecl *> Overlays;
245245
M->findDeclaredCrossImportOverlaysTransitive(Overlays);
246246
for (const auto *OM : Overlays) {
247247
auto CIM = CI.getASTContext().getModuleByName(OM->getNameStr());

0 commit comments

Comments
 (0)