Skip to content

Commit 3d8b2f7

Browse files
authored
Merge pull request #2004 from swiftwasm/main
[pull] swiftwasm from main
2 parents fd0d667 + aa3e590 commit 3d8b2f7

Some content is hidden

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

41 files changed

+262
-379
lines changed

include/swift/AST/Decl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3762,6 +3762,7 @@ struct SelfReferencePosition final {
37623762
case Contravariant:
37633763
return Covariant;
37643764
}
3765+
llvm_unreachable("unhandled self reference position!");
37653766
}
37663767

37673768
explicit operator bool() const { return kind > None; }

include/swift/AST/DiagnosticsSema.def

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2455,16 +2455,10 @@ NOTE(suggest_removing_override, none,
24552455
ERROR(override_less_available,none,
24562456
"overriding %0 must be as available as declaration it overrides",
24572457
(DeclBaseName))
2458-
WARNING(override_less_available_warn,none,
2459-
"overriding %0 must be as available as declaration it overrides",
2460-
(DeclBaseName))
24612458

24622459
ERROR(override_accessor_less_available,none,
24632460
"overriding %0 for %1 must be as available as declaration it overrides",
24642461
(DescriptiveDeclKind, DeclBaseName))
2465-
WARNING(override_accessor_less_available_warn,none,
2466-
"overriding %0 for %1 must be as available as declaration it overrides",
2467-
(DescriptiveDeclKind, DeclBaseName))
24682462

24692463
ERROR(override_let_property,none,
24702464
"cannot override immutable 'let' property %0 with the getter of a 'var'",

include/swift/AST/ForeignErrorConvention.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ class ForeignErrorConvention {
198198
case NonNilError:
199199
return false;
200200
}
201+
llvm_unreachable("unhandled foreign error kind!");
201202
}
202203

203204
bool operator==(ForeignErrorConvention other) const {

include/swift/AST/TypeCheckRequests.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2687,9 +2687,13 @@ enum class CustomAttrTypeKind {
26872687
/// any contextual type parameters.
26882688
NonGeneric,
26892689

2690-
/// Property delegates have some funky rules, like allowing
2690+
/// Property wrappers have some funky rules, like allowing
26912691
/// unbound generic types.
2692-
PropertyDelegate,
2692+
PropertyWrapper,
2693+
2694+
/// Global actors are represented as custom type attributes. They don't
2695+
/// have any particularly interesting semantics.
2696+
GlobalActor,
26932697
};
26942698

26952699
void simple_display(llvm::raw_ostream &out, CustomAttrTypeKind value);

include/swift/AST/TypeRefinementContext.h

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -154,23 +154,16 @@ class TypeRefinementContext {
154154

155155
SourceRange SrcRange;
156156

157-
/// Runtime availability information for the code in this context.
158157
AvailabilityContext AvailabilityInfo;
159158

160-
/// Runtime availability information as explicitly declared by attributes
161-
/// for the inlinable code in this context. Compared to AvailabilityInfo,
162-
/// this is not bounded to the minimum deployment OS version.
163-
AvailabilityContext AvailabilityInfoExplicit;
164-
165159
std::vector<TypeRefinementContext *> Children;
166160

167161
TypeRefinementContext(ASTContext &Ctx, IntroNode Node,
168162
TypeRefinementContext *Parent, SourceRange SrcRange,
169-
const AvailabilityContext &Info,
170-
const AvailabilityContext &InfoExplicit);
163+
const AvailabilityContext &Info);
171164

172165
public:
173-
166+
174167
/// Create the root refinement context for the given SourceFile.
175168
static TypeRefinementContext *createRoot(SourceFile *SF,
176169
const AvailabilityContext &Info);
@@ -179,9 +172,8 @@ class TypeRefinementContext {
179172
static TypeRefinementContext *createForDecl(ASTContext &Ctx, Decl *D,
180173
TypeRefinementContext *Parent,
181174
const AvailabilityContext &Info,
182-
const AvailabilityContext &InfoExplicit,
183175
SourceRange SrcRange);
184-
176+
185177
/// Create a refinement context for the Then branch of the given IfStmt.
186178
static TypeRefinementContext *
187179
createForIfStmtThen(ASTContext &Ctx, IfStmt *S, TypeRefinementContext *Parent,
@@ -248,19 +240,11 @@ class TypeRefinementContext {
248240
SourceRange getSourceRange() const { return SrcRange; }
249241

250242
/// Returns the information on what can be assumed present at run time when
251-
/// running code contained in this context, taking into account the minimum
252-
/// deployment target.
243+
/// running code contained in this context.
253244
const AvailabilityContext &getAvailabilityInfo() const {
254245
return AvailabilityInfo;
255246
}
256247

257-
/// Returns the information on what can be assumed present at run time when
258-
/// running code contained in this context if it were to be inlined,
259-
/// without considering the minimum deployment target.
260-
const AvailabilityContext &getAvailabilityInfoExplicit() const {
261-
return AvailabilityInfoExplicit;
262-
}
263-
264248
/// Adds a child refinement context.
265249
void addChild(TypeRefinementContext *Child) {
266250
assert(Child->getSourceRange().isValid());

include/swift/Demangling/TypeLookupError.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ class TypeLookupError {
150150
delete castContext;
151151
return nullptr;
152152
}
153+
llvm_unreachable("unhandled command!");
153154
};
154155
}
155156

include/swift/Sema/ConstraintSystem.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1907,6 +1907,7 @@ class SolutionApplicationTarget {
19071907
case Kind::patternBinding:
19081908
return patternBinding;
19091909
}
1910+
llvm_unreachable("invalid case label type");
19101911
}
19111912

19121913
VarDecl *getAsUninitializedWrappedVar() const {
@@ -1921,6 +1922,7 @@ class SolutionApplicationTarget {
19211922
case Kind::uninitializedWrappedVar:
19221923
return uninitializedWrappedVar;
19231924
}
1925+
llvm_unreachable("invalid case label type");
19241926
}
19251927

19261928
BraceStmt *getFunctionBody() const {

lib/AST/AutoDiff.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,7 @@ bool swift::operator==(const TangentPropertyInfo::Error &lhs,
462462
case TangentPropertyInfo::Error::Kind::TangentPropertyWrongType:
463463
return lhs.getType()->isEqual(rhs.getType());
464464
}
465+
llvm_unreachable("unhandled tangent property!");
465466
}
466467

467468
void swift::simple_display(llvm::raw_ostream &os, TangentPropertyInfo info) {

lib/AST/Availability.cpp

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,8 @@ static bool isBetterThan(const AvailableAttr *newAttr,
144144
return true;
145145

146146
// If they belong to the same platform, the one that introduces later wins.
147-
if (prevAttr->Platform == newAttr->Platform) {
148-
if (newAttr->isUnconditionallyUnavailable())
149-
return true;
150-
if (prevAttr->isUnconditionallyUnavailable())
151-
return false;
147+
if (prevAttr->Platform == newAttr->Platform)
152148
return prevAttr->Introduced.getValue() < newAttr->Introduced.getValue();
153-
}
154149

155150
// If the new attribute's platform inherits from the old one, it wins.
156151
return inheritsAvailabilityFromPlatform(newAttr->Platform,
@@ -163,12 +158,10 @@ AvailabilityInference::annotatedAvailableRange(const Decl *D, ASTContext &Ctx) {
163158

164159
for (auto Attr : D->getAttrs()) {
165160
auto *AvailAttr = dyn_cast<AvailableAttr>(Attr);
166-
if (AvailAttr == nullptr ||
161+
if (AvailAttr == nullptr || !AvailAttr->Introduced.hasValue() ||
167162
!AvailAttr->isActivePlatform(Ctx) ||
168163
AvailAttr->isLanguageVersionSpecific() ||
169-
AvailAttr->isPackageDescriptionVersionSpecific() ||
170-
(!AvailAttr->Introduced.hasValue() &&
171-
!AvailAttr->isUnconditionallyUnavailable())) {
164+
AvailAttr->isPackageDescriptionVersionSpecific()) {
172165
continue;
173166
}
174167

@@ -179,9 +172,6 @@ AvailabilityInference::annotatedAvailableRange(const Decl *D, ASTContext &Ctx) {
179172
if (!bestAvailAttr)
180173
return None;
181174

182-
if (bestAvailAttr->isUnconditionallyUnavailable())
183-
return AvailabilityContext(VersionRange::empty());
184-
185175
return AvailabilityContext{
186176
VersionRange::allGTE(bestAvailAttr->Introduced.getValue())};
187177
}

lib/AST/ClangTypeConverter.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ const clang::Type *ClangTypeConverter::getFunctionType(
207207
case SILFunctionType::Representation::Closure:
208208
llvm_unreachable("Expected a C-compatible representation.");
209209
}
210+
llvm_unreachable("unhandled representation!");
210211
}
211212

212213
clang::QualType ClangTypeConverter::convertMemberType(NominalTypeDecl *DC,

0 commit comments

Comments
 (0)