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-14899] self is not convertible to Self type #57246

Closed
zienag opened this issue Jul 8, 2021 · 1 comment
Closed

[SR-14899] self is not convertible to Self type #57246

zienag opened this issue Jul 8, 2021 · 1 comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.

Comments

@zienag
Copy link

zienag commented Jul 8, 2021

Previous ID SR-14899
Radar rdar://problem/80384027
Original Reporter @zienag
Type Bug
Status Resolved
Resolution Duplicate
Environment

% swift -version
Apple Swift version 5.3.2 (swiftlang-1200.0.45 clang-1200.0.32.28)
Target: x86_64-apple-darwin20.5.0

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

md5: 1cec24bbfa528abdcd0780056e178611

duplicates:

  • SR-6480 The self value in a class method should always have DynamicSelfType

Issue Description:

Here is a rather strange behaviour, self cannot be used where Self is needed:

final class A {
  func act() {}

  func check() {
    func foo(s: Self) {}
    foo(s: self)
    Self.act(self)
  }
}

error:

file.swift:40:12: error: cannot convert value of type 'A' to expected argument type 'Self'
    foo(s: self)
           ^
                as! Self
file.swift:41:14: error: cannot convert value of type 'A' to expected argument type 'Self'
    Self.act(self)
             ^
                  as! Self
@typesanitizer
Copy link

@swift-ci create

@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.
Projects
None yet
Development

No branches or pull requests

2 participants