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-10201] Type aliases are lost or invalid/inaccessible from nested protocols #52601

Closed
DevAndArtist mannequin opened this issue Mar 27, 2019 · 2 comments
Closed

[SR-10201] Type aliases are lost or invalid/inaccessible from nested protocols #52601

DevAndArtist mannequin opened this issue Mar 27, 2019 · 2 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself regression swift 5.0

Comments

@DevAndArtist
Copy link
Mannequin

DevAndArtist mannequin commented Mar 27, 2019

Previous ID SR-10201
Radar rdar://problem/49522911
Original Reporter @DevAndArtist
Type Bug
Status Resolved
Resolution Done
Environment

Apple Swift version 5.0 (swiftlang-1001.0.69.5 clang-1001.0.46.3)
Target: x86_64-apple-darwin18.2.0
Xcode 10.2
macOS 10.14.3 (18D109)

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

md5: 1e27340a2468e2ccb63d46bc6c138b38

Issue Description:

The following examples used to work in Swift 4.2.1 but now raise errors at compile time with the Swift 5 compiler in Swift 4.2 mode.

struct A {
  typealias Value = Int
}

protocol B {
  typealias Value = A.Value
  typealias X = String
}

protocol NestedProtocol {
  typealias _B = B
}

struct Something: NestedProtocol {
  // workaround: `struct InnerTest: B` but why did it break?

  struct InnerTest: _B { // conforms to `B` but all type aliases are lost
    var value: Value = 42 // error: Use of undeclared type 'Value'
    var x: X = "wait what?" // error Use of undeclared type 'X'
  }
}
protocol X {}

protocol Y {
  typealias _X = X
  var x: _X { get }
}

struct Struct: Y {
  // error: Value of type 'Struct.__X' does not conform to specified type 'Struct._X' (aka 'X')
  var x: _X = __X()
}

extension Struct {
  struct __X: _X {}
}
@DevAndArtist
Copy link
Mannequin Author

DevAndArtist mannequin commented Mar 27, 2019

cc @slavapestov maybe this is related to https://bugs.swift.org/browse/SR-10193

@slavapestov
Copy link
Member

This seems to have been fixed on master. I added a regression test: #28275

@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 regression swift 5.0
Projects
None yet
Development

No branches or pull requests

2 participants