Skip to content

Sema: New syntax for @opened archetypes in textual SIL #60429

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

slavapestov
Copy link
Contributor

The old syntax was

@opened("UUID") constraintType

Where constraintType was the right hand side of a conformance requirement.

This would always create an archetype where the interface type was Self,
so it couldn't cope with member types of opened existential types.

Member types of opened existential types is now a thing with SE-0309, so
this lack of support prevented writing SIL test cases using this feature.

The new syntax is

@opened("UUID", constraintType) interfaceType

The interfaceType is a type parameter rooted in an implicit Self
generic parameter, which is understood to be the underlying type of the
existential.

Fixes rdar://problem/93771238.

@slavapestov slavapestov force-pushed the sil-opened-archetype-syntax branch from 863ad15 to 3bbf815 Compare August 6, 2022 03:49
@slavapestov slavapestov requested a review from atrick August 6, 2022 03:49
@slavapestov slavapestov force-pushed the sil-opened-archetype-syntax branch 3 times, most recently from 80dc346 to cf45a62 Compare August 7, 2022 03:06
@slavapestov
Copy link
Contributor Author

@swift-ci Please test

The old syntax was

    @opened("UUID") constraintType

Where constraintType was the right hand side of a conformance requirement.

This would always create an archetype where the interface type was `Self`,
so it couldn't cope with member types of opened existential types.

Member types of opened existential types is now a thing with SE-0309, so
this lack of support prevented writing SIL test cases using this feature.

The new syntax is

    @opened("UUID", constraintType) interfaceType

The interfaceType is a type parameter rooted in an implicit `Self`
generic parameter, which is understood to be the underlying type of the
existential.

Fixes rdar://problem/93771238.
@slavapestov slavapestov force-pushed the sil-opened-archetype-syntax branch from cf45a62 to d222ac5 Compare August 7, 2022 23:04
@slavapestov
Copy link
Contributor Author

@swift-ci Please test

@slavapestov slavapestov merged commit 7a6c079 into swiftlang:main Aug 8, 2022
visit(T->getGenericEnvironment()->getOpenedExistentialType());
Printer << ") ";

llvm::DenseMap<CanType, Identifier> newAlternativeTypeNames;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like this DenseMap could be a SmallDenseMap since it doesn't escape, normally has one entry, and we regularly print giant .sil files (like up to 100MB)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants