Skip to content
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

[SR-12755] Cannot have an optional property stored property of same type #55200

LucianoPAlmeida opened this issue May 8, 2020 · 4 comments


Copy link

@LucianoPAlmeida LucianoPAlmeida commented May 8, 2020

Previous ID SR-12755
Radar rdar://problem/63031842
Original Reporter @LucianoPAlmeida
Type Bug
Status Closed
Resolution Invalid

Attachment: Download


Swift Development Snapshot 2020-04-29

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee None
Priority Medium

md5: 9d5c1551c5c2aa5dd379d9eb0144adae

Issue Description:

Trying to define a property that contains a stored member of the Self type, gives an error even though the member is optional. The diagnostic would make sense if the type was no-optional because that would require an infinite type, but optional members should be allowed?

![](Screen Shot 2020-05-08 at 11.35.42.png)

Is that a bug or intended behavior?

Copy link
Collaborator Author

@LucianoPAlmeida LucianoPAlmeida commented May 8, 2020

Copy link

@xedin xedin commented May 8, 2020

@swift-ci create

Copy link

@slavapestov slavapestov commented May 21, 2020

Optional<T> stores a copy of T inline, so a value type cannot contain an optional of itself. We cannot change this at this point even if we wanted to because of ABI stability.

Copy link
Collaborator Author

@LucianoPAlmeida LucianoPAlmeida commented May 21, 2020

Ah ok, that's unfortunate. But thanks for taking a look @slavapestov

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

3 participants