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

Closed
LucianoPAlmeida opened this issue May 8, 2020 · 4 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@LucianoPAlmeida
Copy link
Collaborator

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

Attachment: Download

Environment

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?

@LucianoPAlmeida
Copy link
Collaborator Author

cc @xedin @DougGregor

@xedin
Copy link
Member

xedin commented May 8, 2020

@swift-ci create

@slavapestov
Copy link
Member

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.

@LucianoPAlmeida
Copy link
Collaborator Author

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
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself
Projects
None yet
Development

No branches or pull requests

3 participants