Skip to content

Sema: Relax associated type default circularity check #32424

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

We should allow an associated type's default to reference the
same associated type with a base other than 'Self'.

Note that it now becomes easier to defeat this check, but it
was never air-tight anyway -- for example, you could have a
cycle of length two if each associated type's default was the
other associated type.

This is fine, because this check is purely 'cosmetic'; nothing
goes really wrong if you have a cycle here, except that the
diagnostic shifts from the declaration of the protocol to the
conforming type.

Fixes rdar://problem/62355224.

We should allow an associated type's default to reference the
same associated type with a base other than 'Self'.

Note that it now becomes easier to defeat this check, but it
was never air-tight anyway -- for example, you could have a
cycle of length two if each associated type's default was the
other associated type.

This is fine, because this check is purely 'cosmetic'; nothing
goes really wrong if you have a cycle here, except that the
diagnostic shifts from the declaration of the protocol to the
conforming type.

Fixes <rdar://problem/62355224>.
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

@slavapestov slavapestov merged commit 8bcd8a3 into swiftlang:master Jun 17, 2020
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.

1 participant