Skip to content

[Type checker] Allow forward references to local types. #17866

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
merged 1 commit into from
Jul 10, 2018

Conversation

DougGregor
Copy link
Member

Recent work to improve checking for forward references to local types
(#16967) started rejecting code
that referred to a local type before it is defined. Swift previously
accepted such code, because local types can’t capture anyway, so allow
it again… for now.

As a separate action item, I’d like to revisit the language design
here, because it’s somewhat surprising when we can vs. cannot
forward-reference local declarations, and the rules differ from
those of top-level code in scripts and top-level code for non-scripts.

Fixes rdar://problem/41659447

Recent work to improve checking for forward references to local types
(swiftlang#16967) started rejecting code
that referred to a local type before it is defined. Swift previously
accepted such code, because local types can’t capture anyway, so allow
it again… for now.

As a separate action item, I’d like to revisit the language design
here, because it’s somewhat surprising when we can vs. cannot
forward-reference local declarations, and the rules differ from
those of top-level code in scripts *and* top-level code for non-scripts.

Fixes rdar://problem/41659447
@DougGregor
Copy link
Member Author

@swift-ci please smoke test and merge

@swift-ci swift-ci merged commit 955ac3b into swiftlang:master Jul 10, 2018
@DougGregor DougGregor deleted the forward-reference-local-type branch July 10, 2018 23:39
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.

3 participants