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-5993] Cannot subclass to a nested class ('Super' is not a member type of 'Baz'). #48550

Closed
DevAndArtist mannequin opened this issue Sep 26, 2017 · 12 comments
Closed
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@DevAndArtist
Copy link
Mannequin

DevAndArtist mannequin commented Sep 26, 2017

Previous ID SR-5993
Radar None
Original Reporter @DevAndArtist
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Environment

Xcode Version 9.0 (9A235), Swift 4

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

md5: 8d6c77fe197d852dcf28d4056069c764

duplicates:

  • SR-631 Extensions in different files do not recognize each other

relates to:

  • SR-631 Extensions in different files do not recognize each other

Issue Description:

A class that is nested inside a different type through extensions from a different file cannot be subclassed as another nested sub-class in yet another different file. `typealias` cannot be used as a workaround.

See `Bar.Sub1` and `Bar.Sub2` in the attached playground.

This might be related to: https://bugs.swift.org/browse/SR-631

@belkadan
Copy link
Contributor

Your playground has a whole bunch of different examples in it, and I can't reproduce the issue in isolation. Which ones are relevant?

@DevAndArtist
Copy link
Mannequin Author

DevAndArtist mannequin commented Sep 26, 2017

@belkadan The playground contains exactly two examples with the reproducible project structure, which I tried to describe above.

There are two files which will trigger the issue, you can test them individually.

  • Bar.Sub1.swift

  • Bar.Sub2.swift

In each file it's only necessary to uncomment the last commented line to trigger the error. The error will be appear in a different place, on the line where the nested subclass is defined.

@DevAndArtist
Copy link
Mannequin Author

DevAndArtist mannequin commented Sep 26, 2017

@belkadan Here are two screenshots of both of the cases.

@belkadan
Copy link
Contributor

Whoops, you did mention Bar.Sub1.swift and Bar.Sub2.swift. My bad for jumping to the attachment.

@belkadan
Copy link
Contributor

Yeah, I think this is another SR-631, then.

@slavapestov
Copy link
Member

Re-opening this because the interaction between extension binding and subclassing is a bit more subtle than just SR-631.

@DougGregor
Copy link
Member

The example here is fixed by #18364

@DevAndArtist
Copy link
Mannequin Author

DevAndArtist mannequin commented Jul 31, 2018

@DougGregor I assume the comment is the same as on twitter recently. This fix won't land in Swift 4.2?

@DougGregor
Copy link
Member

That's correct. This will not go into Swift 4.2.

@DevAndArtist
Copy link
Mannequin Author

DevAndArtist mannequin commented Jul 31, 2018

@DougGregor Any chance this might go into Swift 4.x (4.3) a couple of month later, or is it something for a major release like Swift 5?

@DougGregor
Copy link
Member

It will have to wait for a major release. This bug fix is a consequence of some significant architectural changes that don't fit into a dot release.

@DevAndArtist
Copy link
Mannequin Author

DevAndArtist mannequin commented Jul 31, 2018

Okay thank you for confirming it.

@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