Skip to content

Commit bfcaa39

Browse files
committed
Remove the GenericSignatureBuilder
Resolves rdar://problem/88136582.
1 parent 3a9c801 commit bfcaa39

20 files changed

+77
-11021
lines changed

Diff for: include/swift/AST/DiagnosticsCommon.def

-4
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,6 @@ NOTE(note_typo_candidate,none,
9090
NOTE(profile_read_error,none,
9191
"failed to load profile data '%0': '%1'", (StringRef, StringRef))
9292

93-
WARNING(protocol_extension_redundant_requirement,none,
94-
"requirement of '%1' to '%2' is redundant in an extension of '%0'",
95-
(StringRef, StringRef, StringRef))
96-
9793
ERROR(attr_only_on_parameters, none,
9894
"'%0' may only be used on parameters", (StringRef))
9995

Diff for: include/swift/AST/DiagnosticsSema.def

-43
Original file line numberDiff line numberDiff line change
@@ -2477,10 +2477,6 @@ ERROR(requires_not_suitable_archetype,none,
24772477
"type %0 in conformance requirement does not refer to a "
24782478
"generic parameter or associated type",
24792479
(Type))
2480-
WARNING(requires_no_same_type_archetype,none,
2481-
"neither type in same-type constraint (%0 or %1) refers to a "
2482-
"generic parameter or associated type",
2483-
(Type, Type))
24842480

24852481
ERROR(requires_generic_params_made_equal,none,
24862482
"same-type requirement makes generic parameters %0 and %1 equivalent",
@@ -2494,71 +2490,32 @@ ERROR(recursive_generic_signature,none,
24942490
"%0 %1 has self-referential generic requirements", (DescriptiveDeclKind, DeclBaseName))
24952491
ERROR(recursive_generic_signature_extension,none,
24962492
"extension of %0 %1 has self-referential generic requirements", (DescriptiveDeclKind, DeclBaseName))
2497-
ERROR(recursive_same_type_constraint,none,
2498-
"same-type constraint %0 == %1 is recursive", (Type, Type))
2499-
ERROR(recursive_superclass_constraint,none,
2500-
"superclass constraint %0 : %1 is recursive", (Type, Type))
2501-
ERROR(requires_generic_param_same_type_does_not_conform,none,
2502-
"same-type constraint type %0 does not conform to required protocol %1",
2503-
(Type, Identifier))
2504-
ERROR(same_type_does_not_inherit,none,
2505-
"same-type constraint type %0 does not inherit from required superclass %1",
2506-
(Type, Type))
25072493
ERROR(requires_same_concrete_type,none,
25082494
"generic signature requires types %0 and %1 to be the same", (Type, Type))
25092495
WARNING(redundant_conformance_constraint,none,
25102496
"redundant conformance constraint %0 : %1", (Type, ProtocolDecl *))
2511-
NOTE(redundant_conformance_here,none,
2512-
"conformance constraint %0 : %1 implied here",
2513-
(Type, ProtocolDecl *))
25142497

25152498
WARNING(missing_protocol_refinement, none,
25162499
"protocol %0 should be declared to refine %1 due to a same-type constraint on 'Self'",
25172500
(ProtocolDecl *, ProtocolDecl *))
25182501

2519-
ERROR(same_type_conflict,none,
2520-
"%select{generic parameter |protocol |}0%1 cannot be equal to both "
2521-
"%2 and %3", (unsigned, Type, Type, Type))
25222502
ERROR(requirement_conflict,none,
25232503
"no type for %0 can satisfy both %1",
25242504
(Type, StringRef))
25252505
WARNING(redundant_same_type_to_concrete,none,
25262506
"redundant same-type constraint %0 == %1", (Type, Type))
2527-
NOTE(same_type_redundancy_here,none,
2528-
"same-type constraint %1 == %2 %select{written here|implied here|"
2529-
"inferred from type here}0",
2530-
(unsigned, Type, Type))
25312507
ERROR(conflicting_superclass_constraints,none,
25322508
"type %0 cannot be a subclass of both %1 and %2",
25332509
(Type, Type, Type))
2534-
NOTE(conflicting_superclass_constraint,none,
2535-
"constraint conflicts with %0 : %1",
2536-
(Type, Type))
25372510
WARNING(redundant_superclass_constraint,none,
25382511
"redundant superclass constraint %0 : %1", (Type, Type))
2539-
NOTE(superclass_redundancy_here,none,
2540-
"superclass constraint %0 : %1 implied here",
2541-
(Type, Type))
25422512

2543-
ERROR(conflicting_layout_constraints,none,
2544-
"type %0 has conflicting constraints %1 and %2",
2545-
(Type, LayoutConstraint, LayoutConstraint))
2546-
NOTE(conflicting_layout_constraint, none,
2547-
"constraint conflicts with %0 : %1",
2548-
(Type, LayoutConstraint))
25492513
WARNING(redundant_layout_constraint,none,
25502514
"redundant constraint %0 : %1",
25512515
(Type, LayoutConstraint))
2552-
NOTE(previous_layout_constraint, none,
2553-
"constraint %0 : %1 implied here",
2554-
(Type, LayoutConstraint))
25552516

25562517
WARNING(redundant_same_type_constraint,none,
25572518
"redundant same-type constraint %0 == %1", (Type, Type))
2558-
NOTE(previous_same_type_constraint, none,
2559-
"previous same-type constraint %1 == %2 "
2560-
"%select{written here|implied here|inferred from type here}0",
2561-
(unsigned, Type, Type))
25622519

25632520
WARNING(inherited_associated_type_redecl,none,
25642521
"redeclaration of associated type %0 from protocol %1 is better "

Diff for: include/swift/AST/TypeCheckRequests.h

-190
Original file line numberDiff line numberDiff line change
@@ -472,48 +472,6 @@ class ProtocolDependenciesRequest :
472472
bool isCached() const { return true; }
473473
};
474474

475-
/// Compute a protocol's requirement signature using the RequirementMachine.
476-
/// This is temporary; once the GenericSignatureBuilder goes away this will
477-
/// be folded into RequirementSignatureRequest.
478-
class RequirementSignatureRequestRQM :
479-
public SimpleRequest<RequirementSignatureRequestRQM,
480-
RequirementSignature(ProtocolDecl *),
481-
RequestFlags::Cached> {
482-
public:
483-
using SimpleRequest::SimpleRequest;
484-
485-
private:
486-
friend SimpleRequest;
487-
488-
// Evaluation.
489-
RequirementSignature
490-
evaluate(Evaluator &evaluator, ProtocolDecl *proto) const;
491-
492-
public:
493-
bool isCached() const { return true; }
494-
};
495-
496-
/// Compute a protocol's requirement signature using the GenericSignatureBuilder.
497-
/// This is temporary; once the GenericSignatureBuilder goes away this will
498-
/// be removed.
499-
class RequirementSignatureRequestGSB :
500-
public SimpleRequest<RequirementSignatureRequestGSB,
501-
RequirementSignature(ProtocolDecl *),
502-
RequestFlags::Cached> {
503-
public:
504-
using SimpleRequest::SimpleRequest;
505-
506-
private:
507-
friend SimpleRequest;
508-
509-
// Evaluation.
510-
RequirementSignature
511-
evaluate(Evaluator &evaluator, ProtocolDecl *proto) const;
512-
513-
public:
514-
bool isCached() const { return true; }
515-
};
516-
517475
/// Compute the requirements that describe a protocol.
518476
class RequirementSignatureRequest :
519477
public SimpleRequest<RequirementSignatureRequest,
@@ -1821,114 +1779,8 @@ class AbstractGenericSignatureRequest :
18211779
}
18221780
};
18231781

1824-
/// Build a generic signature using the RequirementMachine. This is temporary;
1825-
/// once the GenericSignatureBuilder goes away this will be folded into
1826-
/// AbstractGenericSignatureRequest.
1827-
class AbstractGenericSignatureRequestRQM :
1828-
public SimpleRequest<AbstractGenericSignatureRequestRQM,
1829-
GenericSignatureWithError (const GenericSignatureImpl *,
1830-
SmallVector<GenericTypeParamType *, 2>,
1831-
SmallVector<Requirement, 2>),
1832-
RequestFlags::Cached> {
1833-
public:
1834-
using SimpleRequest::SimpleRequest;
1835-
1836-
private:
1837-
friend SimpleRequest;
1838-
1839-
// Evaluation.
1840-
GenericSignatureWithError
1841-
evaluate(Evaluator &evaluator,
1842-
const GenericSignatureImpl *baseSignature,
1843-
SmallVector<GenericTypeParamType *, 2> addedParameters,
1844-
SmallVector<Requirement, 2> addedRequirements) const;
1845-
1846-
public:
1847-
// Separate caching.
1848-
bool isCached() const { return true; }
1849-
1850-
/// Abstract generic signature requests never have source-location info.
1851-
SourceLoc getNearestLoc() const {
1852-
return SourceLoc();
1853-
}
1854-
};
1855-
1856-
/// Build a generic signature using the GenericSignatureBuilder. This is temporary;
1857-
/// once the GenericSignatureBuilder goes away this will be removed.
1858-
class AbstractGenericSignatureRequestGSB :
1859-
public SimpleRequest<AbstractGenericSignatureRequestGSB,
1860-
GenericSignatureWithError (const GenericSignatureImpl *,
1861-
SmallVector<GenericTypeParamType *, 2>,
1862-
SmallVector<Requirement, 2>),
1863-
RequestFlags::Cached> {
1864-
public:
1865-
using SimpleRequest::SimpleRequest;
1866-
1867-
private:
1868-
friend SimpleRequest;
1869-
1870-
// Evaluation.
1871-
GenericSignatureWithError
1872-
evaluate(Evaluator &evaluator,
1873-
const GenericSignatureImpl *baseSignature,
1874-
SmallVector<GenericTypeParamType *, 2> addedParameters,
1875-
SmallVector<Requirement, 2> addedRequirements) const;
1876-
1877-
public:
1878-
// Separate caching.
1879-
bool isCached() const { return true; }
1880-
1881-
/// Abstract generic signature requests never have source-location info.
1882-
SourceLoc getNearestLoc() const {
1883-
return SourceLoc();
1884-
}
1885-
};
1886-
18871782
class InferredGenericSignatureRequest :
18881783
public SimpleRequest<InferredGenericSignatureRequest,
1889-
GenericSignatureWithError (ModuleDecl *,
1890-
const GenericSignatureImpl *,
1891-
GenericParamList *,
1892-
WhereClauseOwner,
1893-
SmallVector<Requirement, 2>,
1894-
SmallVector<TypeLoc, 2>,
1895-
bool),
1896-
RequestFlags::Cached> {
1897-
public:
1898-
using SimpleRequest::SimpleRequest;
1899-
1900-
private:
1901-
friend SimpleRequest;
1902-
1903-
// Evaluation.
1904-
GenericSignatureWithError
1905-
evaluate(Evaluator &evaluator,
1906-
ModuleDecl *parentModule,
1907-
const GenericSignatureImpl *baseSignature,
1908-
GenericParamList *genericParams,
1909-
WhereClauseOwner whereClause,
1910-
SmallVector<Requirement, 2> addedRequirements,
1911-
SmallVector<TypeLoc, 2> inferenceSources,
1912-
bool allowConcreteGenericParams) const;
1913-
1914-
public:
1915-
// Separate caching.
1916-
bool isCached() const { return true; }
1917-
1918-
/// Inferred generic signature requests don't have source-location info.
1919-
SourceLoc getNearestLoc() const {
1920-
return SourceLoc();
1921-
}
1922-
1923-
// Cycle handling.
1924-
void noteCycleStep(DiagnosticEngine &diags) const;
1925-
};
1926-
1927-
/// Build a generic signature using the RequirementMachine. This is temporary;
1928-
/// once the GenericSignatureBuilder goes away this will be folded into
1929-
/// InferredGenericSignatureRequest.
1930-
class InferredGenericSignatureRequestRQM :
1931-
public SimpleRequest<InferredGenericSignatureRequestRQM,
19321784
GenericSignatureWithError (const GenericSignatureImpl *,
19331785
GenericParamList *,
19341786
WhereClauseOwner,
@@ -1965,48 +1817,6 @@ class InferredGenericSignatureRequestRQM :
19651817
void noteCycleStep(DiagnosticEngine &diags) const;
19661818
};
19671819

1968-
/// Build a generic signature using the GenericSignatureBuilder. This is temporary;
1969-
/// once the GenericSignatureBuilder goes away this will be removed.
1970-
class InferredGenericSignatureRequestGSB :
1971-
public SimpleRequest<InferredGenericSignatureRequestGSB,
1972-
GenericSignatureWithError (ModuleDecl *,
1973-
const GenericSignatureImpl *,
1974-
GenericParamList *,
1975-
WhereClauseOwner,
1976-
SmallVector<Requirement, 2>,
1977-
SmallVector<TypeLoc, 2>,
1978-
bool),
1979-
RequestFlags::Cached> {
1980-
public:
1981-
using SimpleRequest::SimpleRequest;
1982-
1983-
private:
1984-
friend SimpleRequest;
1985-
1986-
// Evaluation.
1987-
GenericSignatureWithError
1988-
evaluate(Evaluator &evaluator,
1989-
ModuleDecl *parentModule,
1990-
const GenericSignatureImpl *baseSignature,
1991-
GenericParamList *genericParams,
1992-
WhereClauseOwner whereClause,
1993-
SmallVector<Requirement, 2> addedRequirements,
1994-
SmallVector<TypeLoc, 2> inferenceSources,
1995-
bool allowConcreteGenericParams) const;
1996-
1997-
public:
1998-
// Separate caching.
1999-
bool isCached() const { return true; }
2000-
2001-
/// Inferred generic signature requests don't have source-location info.
2002-
SourceLoc getNearestLoc() const {
2003-
return SourceLoc();
2004-
}
2005-
2006-
// Cycle handling.
2007-
void noteCycleStep(DiagnosticEngine &diags) const;
2008-
};
2009-
20101820
void simple_display(llvm::raw_ostream &out, const TypeLoc source);
20111821

20121822
class ExtendedTypeRequest

Diff for: include/swift/AST/TypeCheckerTypeIDZone.def

+1-34
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,6 @@ SWIFT_REQUEST(TypeChecker, AbstractGenericSignatureRequest,
2020
SmallVector<GenericTypeParamType *, 2>,
2121
SmallVector<Requirement, 2>),
2222
Cached, NoLocationInfo)
23-
SWIFT_REQUEST(TypeChecker, AbstractGenericSignatureRequestRQM,
24-
GenericSignatureWithError (const GenericSignatureImpl *,
25-
SmallVector<GenericTypeParamType *, 2>,
26-
SmallVector<Requirement, 2>),
27-
Cached, NoLocationInfo)
28-
SWIFT_REQUEST(TypeChecker, AbstractGenericSignatureRequestGSB,
29-
GenericSignatureWithError (const GenericSignatureImpl *,
30-
SmallVector<GenericTypeParamType *, 2>,
31-
SmallVector<Requirement, 2>),
32-
Cached, NoLocationInfo)
3323
SWIFT_REQUEST(TypeChecker, ApplyAccessNoteRequest,
3424
evaluator::SideEffect(ValueDecl *), Cached, NoLocationInfo)
3525
SWIFT_REQUEST(TypeChecker, AttachedResultBuilderRequest,
@@ -188,24 +178,7 @@ SWIFT_REQUEST(TypeChecker, HasImplementationOnlyImportsRequest,
188178
SWIFT_REQUEST(TypeChecker, ModuleLibraryLevelRequest,
189179
LibraryLevel(ModuleDecl *), Cached, NoLocationInfo)
190180
SWIFT_REQUEST(TypeChecker, InferredGenericSignatureRequest,
191-
GenericSignatureWithError (ModuleDecl *,
192-
const GenericSignatureImpl *,
193-
GenericParamList *,
194-
WhereClauseOwner,
195-
SmallVector<Requirement, 2>,
196-
SmallVector<TypeLoc, 2>, bool),
197-
Cached, NoLocationInfo)
198-
SWIFT_REQUEST(TypeChecker, InferredGenericSignatureRequestRQM,
199-
GenericSignatureWithError (ModuleDecl *,
200-
const GenericSignatureImpl *,
201-
GenericParamList *,
202-
WhereClauseOwner,
203-
SmallVector<Requirement, 2>,
204-
SmallVector<TypeLoc, 2>, bool),
205-
Cached, NoLocationInfo)
206-
SWIFT_REQUEST(TypeChecker, InferredGenericSignatureRequestGSB,
207-
GenericSignatureWithError (ModuleDecl *,
208-
const GenericSignatureImpl *,
181+
GenericSignatureWithError (const GenericSignatureImpl *,
209182
GenericParamList *,
210183
WhereClauseOwner,
211184
SmallVector<Requirement, 2>,
@@ -304,12 +277,6 @@ SWIFT_REQUEST(TypeChecker, TypeAliasRequirementsRequest,
304277
SWIFT_REQUEST(TypeChecker, ProtocolDependenciesRequest,
305278
ArrayRef<ProtocolDecl *>(ProtocolDecl *), Cached,
306279
HasNearestLocation)
307-
SWIFT_REQUEST(TypeChecker, RequirementSignatureRequestRQM,
308-
RequirementSignature(ProtocolDecl *), Cached,
309-
NoLocationInfo)
310-
SWIFT_REQUEST(TypeChecker, RequirementSignatureRequestGSB,
311-
RequirementSignature(ProtocolDecl *), Cached,
312-
NoLocationInfo)
313280
SWIFT_REQUEST(TypeChecker, RequirementSignatureRequest,
314281
RequirementSignature(ProtocolDecl *), SeparatelyCached,
315282
NoLocationInfo)

0 commit comments

Comments
 (0)