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-14842] Code completion reporting wrong base of type alias on generic function #57189

Open
ahoppen opened this issue Jun 28, 2021 · 1 comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. code completion Area → source tooling: code completion source tooling Area: IDE support, SourceKit, and other source tooling

Comments

@ahoppen
Copy link
Collaborator

ahoppen commented Jun 28, 2021

Previous ID SR-14842
Radar rdar://79862826
Original Reporter @ahoppen
Type Bug
Additional Detail from JIRA
Votes 0
Component/s CodeCompletion
Labels Bug
Assignee None
Priority Medium

md5: 13bbc4a62166141d507c9a58a580f9ae

Issue Description:

Consider this test case.

// RUN: %swift-ide-test --code-completion --source-filename %s --code-completion-token=COMPLETE

public class Foo {
  typealias Value = Int
}

public class Foo2: Foo {
  typealias Value = String
}

public class Bar<T: Foo> {
  func foo() -> T.Value {
    fatalError()
  }
}

func f(x: Bar<Foo2>) {
  x.#^COMPLETE^#
}

It reports

Begin completions, 2 items
Keyword[self]/CurrNominal:          self[#Bar<Foo2>#]; name=self
Decl[InstanceMethod]/CurrNominal/TypeRelation[Identical]: foo()[#Foo.Value#]; name=foo()
End completions

But since x is of type Bar<Foo2> (not Bar<Foo>), the return type of foo should be Foo2.Value, not Foo.Value.

@typesanitizer
Copy link

@swift-ci create

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added the source tooling Area: IDE support, SourceKit, and other source tooling label Feb 6, 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. code completion Area → source tooling: code completion source tooling Area: IDE support, SourceKit, and other source tooling
Projects
None yet
Development

No branches or pull requests

3 participants