// 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.
Additional Detail from JIRA
| | | |------------------|-----------------| |Votes | 0 | |Component/s | CodeCompletion | |Labels | Bug | |Assignee | None | |Priority | Medium | md5: 13bbc4a62166141d507c9a58a580f9aeIssue Description:
Consider this test case.
It reports
But since
x
is of typeBar<Foo2>
(notBar<Foo>
), the return type offoo
should beFoo2.Value
, notFoo.Value
.