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

self.self.self.self.self compilation issue #63351

Open
endeavour42 opened this issue Feb 1, 2023 · 1 comment
Open

self.self.self.self.self compilation issue #63351

endeavour42 opened this issue Feb 1, 2023 · 1 comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler itself expressions Feature: expressions not a bug Resolution → not a bug: Reported as a bug but turned out to be expected behavior or programmer error

Comments

@endeavour42
Copy link

endeavour42 commented Feb 1, 2023

Description
self.self.self.self.self compilation issue

Steps to reproduce
This compiles:

struct Foo {
    subscript(index: Int) -> Int { 42 }
    
    func foo() {
        _ = self.self.self.self.self[1] // any number of self
    }
}

Expected behavior

It should give a compilation error.

Environment

  • Swift compiler version info 5.7
  • Xcode version info 14.0.1
@endeavour42 endeavour42 added bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. triage needed This issue needs more specific labels labels Feb 1, 2023
@AnthonyLatsis
Copy link
Collaborator

AnthonyLatsis commented Feb 1, 2023

Why shouldn’t it compile? x.self (including self.self) is a valid expression, and an identity transform.

@AnthonyLatsis AnthonyLatsis added compiler The Swift compiler itself expressions Feature: expressions not a bug Resolution → not a bug: Reported as a bug but turned out to be expected behavior or programmer error and removed triage needed This issue needs more specific labels labels Feb 1, 2023
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 itself expressions Feature: expressions not a bug Resolution → not a bug: Reported as a bug but turned out to be expected behavior or programmer error
Projects
None yet
Development

No branches or pull requests

2 participants