Skip to content

Commit 25e4cfc

Browse files
committed
fix build failures
1 parent e4dc295 commit 25e4cfc

File tree

3 files changed

+11
-21
lines changed

3 files changed

+11
-21
lines changed

include/swift/AST/ASTContext.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -415,9 +415,6 @@ class ASTContext final {
415415
void setStatsReporter(UnifiedStatsReporter *stats);
416416

417417
private:
418-
/// Set the lazy resolver for this context.
419-
void setLazyResolver(LazyResolver *resolver);
420-
421418
// get `<` or `==`
422419
FuncDecl *getBinaryComparisonOperatorIntDecl(StringRef op, FuncDecl **cached) const;
423420

lib/Sema/DerivedConformanceComparable.cpp

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -306,15 +306,16 @@ deriveComparable_lt(
306306
DerivedConformance &derived,
307307
std::pair<BraceStmt *, bool> (*bodySynthesizer)(AbstractFunctionDecl *,
308308
void *)) {
309-
ASTContext &C = derived.TC.Context;
309+
ASTContext &C = derived.Context;
310310

311311
auto parentDC = derived.getConformanceContext();
312312
auto selfIfaceTy = parentDC->getDeclaredInterfaceType();
313313

314314
auto getParamDecl = [&](StringRef s) -> ParamDecl * {
315-
auto *param = new (C) ParamDecl(ParamDecl::Specifier::Default, SourceLoc(),
315+
auto *param = new (C) ParamDecl(SourceLoc(),
316316
SourceLoc(), Identifier(), SourceLoc(),
317317
C.getIdentifier(s), parentDC);
318+
param->setSpecifier(ParamSpecifier::Default);
318319
param->setInterfaceType(selfIfaceTy);
319320
return param;
320321
};
@@ -356,28 +357,20 @@ deriveComparable_lt(
356357
auto comparableDeclName = DeclName(C, DeclBaseName(C.Id_LessThanOperator),
357358
argumentLabels);
358359
comparableDecl->getAttrs().add(new (C) ImplementsAttr(SourceLoc(),
359-
SourceRange(),
360-
comparableTypeLoc,
361-
comparableDeclName,
362-
DeclNameLoc()));
360+
SourceRange(),
361+
comparableTypeLoc,
362+
comparableDeclName,
363+
DeclNameLoc()));
363364
}
364365

365366
if (!C.getLessThanIntDecl()) {
366-
derived.TC.diagnose(derived.ConformanceDecl->getLoc(),
367-
diag::no_less_than_overload_for_int);
367+
derived.ConformanceDecl->diagnose(diag::no_less_than_overload_for_int);
368368
return nullptr;
369369
}
370370

371371
comparableDecl->setBodySynthesizer(bodySynthesizer);
372372

373-
// Compute the interface type.
374-
comparableDecl->setGenericSignature(parentDC->getGenericSignatureOfContext());
375-
comparableDecl->computeType();
376-
377373
comparableDecl->copyFormalAccessFrom(derived.Nominal, /*sourceIsParentContext*/ true);
378-
comparableDecl->setValidationToChecked();
379-
380-
C.addSynthesizedDecl(comparableDecl);
381374

382375
// Add the operator to the parent scope.
383376
derived.addMembersToConformanceContext({comparableDecl});
@@ -413,6 +406,6 @@ ValueDecl *DerivedConformance::deriveComparable(ValueDecl *requirement) {
413406
llvm_unreachable("todo");
414407
}
415408
}
416-
TC.diagnose(requirement->getLoc(), diag::broken_comparable_requirement);
409+
requirement->diagnose(diag::broken_comparable_requirement);
417410
return nullptr;
418411
}

test/Sema/enum_conformance_synthesis.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,12 +337,12 @@ func pit(_ a: Angel, against b: Angel) -> Bool {
337337
}
338338

339339
// enums with non-conforming payloads don’t get synthesized Comparable
340-
enum Notice: Comparable { // expected-error{{type 'Notice' does not conform to protocol 'Comparable'}} expected-error{{type 'Notice' does not conform to protocol 'Equatable'}} expected-note {{do you want to add protocol stubs?}} expected-note {{do you want to add protocol stubs?}}
340+
enum Notice: Comparable { // expected-error{{type 'Notice' does not conform to protocol 'Comparable'}} expected-error{{type 'Notice' does not conform to protocol 'Equatable'}}
341341
case taylor((Int, Int)), taylornation(Int) // expected-note{{associated value type '(Int, Int)' does not conform to protocol 'Equatable', preventing synthesized conformance of 'Notice' to 'Equatable'}}
342342
}
343343

344344
// neither do enums with raw values
345-
enum Track: Int, Comparable { // expected-error{{type 'Track' does not conform to protocol 'Comparable'}} expected-note {{do you want to add protocol stubs?}}
345+
enum Track: Int, Comparable { // expected-error{{type 'Track' does not conform to protocol 'Comparable'}}
346346
case four = 4
347347
case five = 5
348348
case six = 6

0 commit comments

Comments
 (0)