File tree Expand file tree Collapse file tree 4 files changed +9
-7
lines changed Expand file tree Collapse file tree 4 files changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -176,7 +176,7 @@ TYPE(DynamicSelf, Type)
176
176
ABSTRACT_TYPE(Substitutable, Type)
177
177
ABSTRACT_TYPE(Archetype, SubstitutableType)
178
178
ALWAYS_CANONICAL_TYPE(PrimaryArchetype, ArchetypeType)
179
- ALWAYS_CANONICAL_TYPE (OpaqueTypeArchetype, ArchetypeType)
179
+ TYPE (OpaqueTypeArchetype, ArchetypeType)
180
180
ABSTRACT_TYPE(LocalArchetype, ArchetypeType)
181
181
ALWAYS_CANONICAL_TYPE(ExistentialArchetype, LocalArchetypeType)
182
182
ALWAYS_CANONICAL_TYPE(ElementArchetype, LocalArchetypeType)
Original file line number Diff line number Diff line change @@ -6027,11 +6027,6 @@ GenericEnvironment *GenericEnvironment::forPrimary(GenericSignature signature) {
6027
6027
// / outer substitutions.
6028
6028
GenericEnvironment *GenericEnvironment::forOpaqueType (
6029
6029
OpaqueTypeDecl *opaque, SubstitutionMap subs) {
6030
- // TODO: We could attempt to preserve type sugar in the substitution map.
6031
- // Currently archetypes are assumed to be always canonical in many places,
6032
- // though, so doing so would require fixing those places.
6033
- subs = subs.getCanonical ();
6034
-
6035
6030
auto &ctx = opaque->getASTContext ();
6036
6031
6037
6032
auto properties = ArchetypeType::archetypeProperties (
Original file line number Diff line number Diff line change @@ -227,7 +227,6 @@ GenericEnvironment::GenericEnvironment(
227
227
GenericEnvironment::GenericEnvironment (
228
228
GenericSignature sig, OpaqueTypeDecl *opaque, SubstitutionMap subs)
229
229
: sig(sig), kind(Kind::Opaque), canonical(subs.isCanonical()) {
230
- ASSERT (canonical);
231
230
*getTrailingObjects<SubstitutionMap>() = subs;
232
231
new (getTrailingObjects<OpaqueEnvironmentData>())
233
232
OpaqueEnvironmentData{opaque};
Original file line number Diff line number Diff line change @@ -2023,6 +2023,14 @@ CanType TypeBase::computeCanonicalType() {
2023
2023
Result = ErrorUnionType::get (ctx, newTerms).getPointer ();
2024
2024
break ;
2025
2025
}
2026
+ case TypeKind::OpaqueTypeArchetype: {
2027
+ auto *AT = cast<OpaqueTypeArchetypeType>(this );
2028
+ Result = OpaqueTypeArchetypeType::get (
2029
+ AT->getDecl (), AT->getInterfaceType (),
2030
+ AT->getSubstitutions ().getCanonical ())
2031
+ ->castTo <OpaqueTypeArchetypeType>();
2032
+ break ;
2033
+ }
2026
2034
case TypeKind::Integer: {
2027
2035
auto intTy = cast<IntegerType>(this );
2028
2036
APInt value = intTy->getValue ();
You can’t perform that action at this time.
0 commit comments