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)
176176ABSTRACT_TYPE(Substitutable, Type)
177177 ABSTRACT_TYPE(Archetype, SubstitutableType)
178178 ALWAYS_CANONICAL_TYPE(PrimaryArchetype, ArchetypeType)
179- ALWAYS_CANONICAL_TYPE (OpaqueTypeArchetype, ArchetypeType)
179+ TYPE (OpaqueTypeArchetype, ArchetypeType)
180180 ABSTRACT_TYPE(LocalArchetype, ArchetypeType)
181181 ALWAYS_CANONICAL_TYPE(ExistentialArchetype, LocalArchetypeType)
182182 ALWAYS_CANONICAL_TYPE(ElementArchetype, LocalArchetypeType)
Original file line number Diff line number Diff line change @@ -6027,11 +6027,6 @@ GenericEnvironment *GenericEnvironment::forPrimary(GenericSignature signature) {
60276027// / outer substitutions.
60286028GenericEnvironment *GenericEnvironment::forOpaqueType (
60296029 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-
60356030 auto &ctx = opaque->getASTContext ();
60366031
60376032 auto properties = ArchetypeType::archetypeProperties (
Original file line number Diff line number Diff line change @@ -227,7 +227,6 @@ GenericEnvironment::GenericEnvironment(
227227GenericEnvironment::GenericEnvironment (
228228 GenericSignature sig, OpaqueTypeDecl *opaque, SubstitutionMap subs)
229229 : sig(sig), kind(Kind::Opaque), canonical(subs.isCanonical()) {
230- ASSERT (canonical);
231230 *getTrailingObjects<SubstitutionMap>() = subs;
232231 new (getTrailingObjects<OpaqueEnvironmentData>())
233232 OpaqueEnvironmentData{opaque};
Original file line number Diff line number Diff line change @@ -2023,6 +2023,14 @@ CanType TypeBase::computeCanonicalType() {
20232023 Result = ErrorUnionType::get (ctx, newTerms).getPointer ();
20242024 break ;
20252025 }
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+ }
20262034 case TypeKind::Integer: {
20272035 auto intTy = cast<IntegerType>(this );
20282036 APInt value = intTy->getValue ();
You can’t perform that action at this time.
0 commit comments